/* Estilos para el Sistema Bancario */

/* Header específico del banco */
.bank-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
    color: #fff;
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.bank-header h1 {
    font-size: 2.25rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bank-header p {
    margin: 0.5rem 0 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Layout principal */
.bank-dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Estilos para móviles (base) */
.bank-summary,
.bank-accounts,
.bank-transactions,
.bank-operations {
    width: 100%;
    overflow: hidden;
}

/* Media queries mejorados */
@media (min-width: 768px) {
    .bank-dashboard {
        grid-template-columns: repeat(12, 1fr);
    }
    
    .bank-summary {
        grid-column: span 12;
    }
    
    .bank-accounts {
        grid-column: span 12;
    }
    
    .bank-transactions {
        grid-column: span 12;
    }
    
    .bank-operations {
        grid-column: span 12;
    }
}

@media (min-width: 992px) {
    .bank-summary {
        grid-column: span 12;
    }
    
    .bank-accounts {
        grid-column: span 6;
    }
    
    .bank-transactions {
        grid-column: span 6;
    }
    
    .bank-operations {
        grid-column: span 12;
    }
}

@media (min-width: 1200px) {
    .bank-summary {
        grid-column: span 12;
    }
    
    .bank-accounts {
        grid-column: span 4;
    }
    
    .bank-transactions {
        grid-column: span 8;
    }
    
    .bank-operations {
        grid-column: span 12; /* Cambiado de 8 a 12 para ocupar todo el ancho */
    }
}

/* Secciones */
.bank-section {
    background-color: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bank-section:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e40af;
    margin: 0 0 1.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: #2563eb;
}

.section-header .section-title {
    margin-bottom: 0;
}

.section-header .filters {
    display: flex;
    gap: 0.75rem;
}

/* Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 576px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

.stat-card {
    background-color: #fff;
    border-radius: 0.5rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    border-left: 4px solid #3b82f6;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
}

.stat-card:nth-child(1) {
    border-left-color: #3b82f6; /* Azul */
}

.stat-card:nth-child(2) {
    border-left-color: #10b981; /* Verde */
}

.stat-card:nth-child(3) {
    border-left-color: #f59e0b; /* Ámbar */
}

.stat-card:nth-child(4) {
    border-left-color: #8b5cf6; /* Púrpura */
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card:nth-child(1) .stat-icon {
    background-color: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.stat-card:nth-child(2) .stat-icon {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.stat-card:nth-child(3) .stat-icon {
    background-color: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.stat-card:nth-child(4) .stat-icon {
    background-color: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0;
}

.stat-content p {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.25rem 0 0 0;
    color: #111827;
}

/* Gráficos */
.charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .charts-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

.chart-card {
    background-color: #fff;
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.chart-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-container {
    position: relative;
    height: 250px;
}

/* Cuentas */
.accounts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

@media (min-width: 576px) {
    .accounts-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

.account-card {
    background-color: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    border-left: 5px solid #3b82f6;
}

.account-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.account-bank {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.account-bank-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1rem;
}

.account-bank-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 1.1rem;
}

.account-number {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.account-balance {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: auto;
}

.account-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
}

.status-active {
    background-color: #d1fae5;
    color: #059669;
}

.status-blocked {
    background-color: #fee2e2;
    color: #ef4444;
}

.status-expired {
    background-color: #fef3c7;
    color: #d97706;
}

.inactive-account {
    opacity: 0.7;
}

/* Transacciones */
.transactions-table-container {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto; /* Permitir scroll horizontal en pantallas pequeñas */
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Ancho mínimo para evitar compresión excesiva */
}

.transactions-table thead {
    position: sticky;
    top: 0;
    background-color: #f9fafb;
    z-index: 1;
}

.transactions-table th, 
.transactions-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.transactions-table thead th {
    font-weight: 600;
    color: #374151;
}

.transactions-table tbody tr:hover {
    background-color: #f9fafb;
}

.transaction-amount {
    font-weight: 600;
    white-space: nowrap;
}

.transaction-positive {
    color: #10b981;
}

.transaction-negative {
    color: #ef4444;
}

.transaction-type {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    min-width: 6rem;
}

.type-payment {
    background-color: #fee2e2;
    color: #ef4444;
}

.type-deposit {
    background-color: #d1fae5;
    color: #059669;
}

.type-transfer_in {
    background-color: #e0f2fe;
    color: #0284c7;
}

.type-transfer_out {
    background-color: #fef3c7;
    color: #d97706;
}

.empty-message {
    padding: 2rem !important;
    text-align: center;
    color: #6b7280;
}

.empty-message i {
    margin-right: 0.5rem;
}

/* Mejoras en la visualización de transacciones */
.transaction-date {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.transaction-description {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.transaction-account {
    margin-top: 2px;
    font-size: 0.875rem;
    color: #6b7280;
}

.transaction-type {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.type-payment { background: #fee2e2; color: #ef4444; }
.type-deposit { background: #dcfce7; color: #10b981; }
.type-transfer_in { background: #dbeafe; color: #3b82f6; }
.type-transfer_out { background: #fef3c7; color: #f59e0b; }

.transactions-table td {
    padding: 12px;
    vertical-align: top;
}

.text-gray-500 {
    color: #6b7280;
}

.text-sm {
    font-size: 0.875rem;
}

/* Operaciones */
.operations-tabs {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    height: 100%;
}

.tabs-header {
    display: flex;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
    padding: 0.875rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    flex: 1;
    font-size: 0.95rem;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

.tab-btn:hover {
    color: #3b82f6;
    background-color: #f0f7ff;
}

.tab-btn.active {
    color: #3b82f6;
    font-weight: 600;
    background-color: #f0f7ff;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #3b82f6;
}

@media (max-width: 576px) {
    .tabs-header {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .tab-btn:last-child {
        border-bottom: none;
    }
    
    .tab-btn.active {
        border-bottom: 1px solid #e5e7eb;
        border-left: 4px solid #3b82f6;
    }
    
    .tab-btn.active::after {
        width: 2px;
        height: 100%;
        top: 0;
        left: 0;
        bottom: auto;
    }
}

@media (min-width: 577px) and (max-width: 1199px) {
    /* Estilo para tabletas */
    .operations-tabs {
        max-width: 100%;
        margin: 0 auto;
    }
}

@media (min-width: 1200px) {
    /* Estilo para escritorio */
    .operations-tabs {
        display: flex;
        flex-direction: column;
        max-width: 900px;
        margin: 0 auto;
    }
    
    .tabs-content {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
    }
    
    .tab-content.active {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
    }
    
    .tab-content form {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }
}

.tabs-content {
    padding: 1.5rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Formularios */
.form-group {
    margin-bottom: 1.25rem;
}

@media (min-width: 992px) {
    .form-group {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
    
    #transferForm, #depositForm, #reportForm {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    #transferForm .form-group, 
    #depositForm .form-group, 
    #reportForm .form-group {
        width: 100%;
        max-width: 500px;
    }
    
    #transferForm button, 
    #depositForm button, 
    #reportForm button {
        width: auto;
        min-width: 200px;
    }
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: #374151;
}

.sub-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.input-icon-wrapper {
    position: relative;
}

.input-icon-prefix {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
}

.input-icon-wrapper input {
    padding-left: 2rem;
}

.date-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 576px) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    .date-range {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .tabs-header {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
        padding: 0.75rem 0.5rem;
    }
}

/* Botones */
.btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-primary {
    margin-top: 1rem;
}

@media (min-width: 992px) {
    .btn-primary {
        margin-top: 1.5rem;
    }
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: #f3f4f6;
    color: #374151;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: #e5e7eb;
}

.form-select {
    padding: 0.625rem 2rem 0.625rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Modal de detalles de cuenta */
.account-detail-info {
    display: flex;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.account-bank-logo {
    width: 4rem;
    height: 4rem;
    background-color: #f0f7ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
    font-size: 1.75rem;
    color: #3b82f6;
    flex-shrink: 0;
}

.account-detail-data {
    flex-grow: 1;
}

.account-detail-data p {
    margin: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed #f3f4f6;
    padding-bottom: 0.5rem;
}

.account-detail-data strong {
    color: #374151;
}

.account-detail-transactions h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.account-transactions-table-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

@media (max-width: 576px) {
    .account-detail-info {
        flex-direction: column;
    }
    
    .account-bank-logo {
        margin-bottom: 1rem;
        margin-right: 0;
        align-self: center;
    }
    
    .modal-content {
        width: 95%;
        max-width: 100%;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Estado de carga */
.loading {
    padding: 3rem 1rem;
    text-align: center;
    color: #6b7280;
}

.loading i {
    margin-right: 0.5rem;
    color: #3b82f6;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Notificación */
.notification {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1100;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease;
    max-width: 24rem;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.success {
    background-color: #ecfdf5;
    color: #059669;
    border-left: 4px solid #10b981;
}

.notification.error {
    background-color: #fef2f2;
    color: #b91c1c;
    border-left: 4px solid #ef4444;
}

.notification.info {
    background-color: #eff6ff;
    color: #1d4ed8;
    border-left: 4px solid #3b82f6;
}

.notification.warning {
    background-color: #fffbeb;
    color: #b45309;
    border-left: 4px solid #f59e0b;
}

/* Estilos de impresión */
@media print {
    header, footer, .bank-header, .section-header, .tabs-header, .modal-header, .modal-footer {
        display: none !important;
    }
    
    .bank-dashboard, .bank-section, .chart-card, .account-card, .transactions-table-container {
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
        break-inside: avoid;
    }
    
    .modal-content {
        box-shadow: none !important;
        position: static !important;
        transform: none !important;
        max-height: none !important;
    }
    
    .account-transactions-table-container, .transactions-table-container {
        max-height: none !important;
        overflow: visible !important;
    }
}
