/* Sterling Custody Bank - Dashboard Styles CORREGIDO */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* HEADER - CORREGIDO CON Z-INDEX ALTO */
.dashboard-header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    z-index: 10000; /* MUY ALTO PARA ESTAR SIEMPRE ENCIMA */
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 2rem;
    background: white;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10001;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #333;
    cursor: pointer;
    padding: 0.5rem;
}

.header-logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1e3a5f 0%, #d4af37 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 500px;
}

.header-search {
    display: flex;
    background: #f5f5f5;
    border-radius: 25px;
    overflow: hidden;
    width: 100%;
}

.header-search input {
    border: none;
    background: none;
    padding: 0.5rem 1rem;
    width: 100%;
    outline: none;
}

.header-search button {
    background: none;
    border: none;
    padding: 0 1rem;
    color: #666;
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc3545;
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.header-user {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #1e3a5f 0%, #d4af37 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-name {
    font-weight: 500;
    color: #333;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    min-width: 250px;
    margin-top: 0.5rem;
    display: none;
    z-index: 10002;
}

.header-user:hover .user-dropdown {
    display: block;
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-menu a:hover {
    background: #f8f9fa;
}

.dropdown-menu a.text-danger {
    color: #dc3545;
}

.dropdown-divider {
    border-top: 1px solid #e0e0e0;
    margin: 0.5rem 0;
}

/* SIDEBAR */
.dashboard-sidebar {
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    width: 260px;
    background: white;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 99;
}

.dashboard-sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    padding: 0.5rem 0;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.85rem;
    color: #999;
    text-transform: uppercase;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    background: #f8f9fa;
    color: #333;
}

.nav-item.active {
    background: rgba(212, 175, 55, 0.1);
    color: #d4af37;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #d4af37;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-item.text-danger {
    color: #dc3545;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.summary-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.summary-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

/* MAIN CONTENT */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.dashboard-main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    padding-top: 90px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.dashboard-main.expanded {
    margin-left: 0;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* BALANCE CARDS */
.balance-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.balance-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: transform 0.3s;
}

.balance-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.balance-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.balance-card.available .balance-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.balance-card.pending .balance-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.balance-card.total .balance-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.balance-info {
    flex: 1;
}

.balance-info h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.balance-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3a5f;
}

/* QUICK ACTIONS */
.quick-actions-section {
    margin-bottom: 2rem;
}

.quick-actions-section h2 {
    margin-bottom: 1rem;
    color: #1e3a5f;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.action-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.action-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #1e3a5f 0%, #d4af37 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.action-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.action-card p {
    font-size: 0.85rem;
    color: #666;
}

/* CARD 3D - ARREGLADO PARA QUE NO SE SALGA */
.card-display-section {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.card-display-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #1e3a5f;
}

.card-3d-wrapper {
    display: flex;
    justify-content: center;
    padding: 2rem;
    perspective: 1000px;
}

.credit-card-3d {
    width: 400px;
    height: 250px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s;
    cursor: pointer;
}

.credit-card-3d.flipped {
    transform: rotateY(180deg);
}

.card-inner-3d {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.card-front-3d,
.card-back-3d {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden; /* IMPORTANTE: evita que el contenido se salga */
}

.card-front-3d {
    color: white;
}

.card-back-3d {
    transform: rotateY(180deg);
    color: white;
}

.card-bank-name {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.card-chip {
    width: 45px;
    height: 35px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    border-radius: 6px;
    margin: 0.5rem 0;
}

.card-number {
    font-size: 1.2rem;
    color: white;
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    margin: 0.5rem 0;
    font-family: 'Courier New', monospace;
    word-break: break-all; /* Evita overflow */
}

.card-details {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.5rem;
}

.card-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}

.card-name,
.card-expiry-date {
    color: white;
    font-size: 0.9rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.card-logo {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    font-style: italic;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.card-magnetic-strip {
    width: calc(100% + 3rem);
    height: 50px;
    background: #000;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
}

.card-signature-panel {
    background: white;
    height: 40px;
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    border-radius: 5px;
}

.card-signature {
    font-family: cursive;
    color: #333;
    font-size: 0.85rem;
}

.card-cvv-box {
    background: #f0f0f0;
    padding: 0.25rem 0.5rem;
    border: 1px solid #ddd;
    font-family: monospace;
    color: #333;
    font-weight: bold;
    font-size: 0.9rem;
}

.card-back-info {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.8);
}

/* TABLES */
.recent-transactions {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.view-all {
    color: #d4af37;
    text-decoration: none;
    font-weight: 500;
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tbody tr:hover {
    background: #fafafa;
}

.amount {
    font-weight: 600;
    color: #dc3545;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: #d4d4d8;
    margin-bottom: 1rem;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .dashboard-main {
        margin-left: 0;
    }
    
    .dashboard-sidebar {
        transform: translateX(-100%);
    }
    
    .dashboard-sidebar.active {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block !important;
    }
    
    .header-search {
        display: none;
    }
    
    .dashboard-main {
        padding: 1rem;
        padding-top: 80px;
    }
    
    .credit-card-3d {
        width: 100%;
        max-width: 350px;
        height: 220px;
    }
    
    .balance-cards,
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
}
/* ========================================
   RESPONSIVE & MOBILE OPTIMIZATIONS
   ======================================== */

/* Mobile First Base Styles */
@media screen and (max-width: 768px) {
    /* Typography */
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Header Mobile */
    .top-header .header-center {
        display: none;
    }
    
    .top-header .user-name {
        display: none;
    }
    
    .top-header .header-container {
        padding: 0 1rem;
    }
    
    /* Sidebar Mobile */
    .dashboard-sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 9999;
    }
    
    .dashboard-sidebar.active {
        transform: translateX(0);
    }
    
    /* Main Content Mobile */
    .dashboard-main {
        margin-left: 0;
        padding: 1rem;
        padding-top: 80px;
    }
    
    /* Balance Cards Mobile */
    .balance-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .balance-card {
        padding: 1.25rem;
    }
    
    .balance-amount {
        font-size: 1.25rem;
    }
    
    /* Quick Actions Mobile */
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .action-card {
        padding: 1rem;
    }
    
    .action-card h3 {
        font-size: 0.9rem;
    }
    
    .action-card p {
        font-size: 0.75rem;
    }
    
    /* Forms Mobile */
    .form-grid {
        grid-template-columns: 1fr !important;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Tables Mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Buttons Mobile */
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .btn-large {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Cards Mobile */
    .credit-card-3d,
    .credit-card-wrapper,
    .credit-card-3d-large {
        width: 100%;
        max-width: 340px;
        height: 215px;
    }
    
    .card-number,
    .card-number-display {
        font-size: 1.1rem;
        letter-spacing: 2px;
    }
    
    /* Alerts Mobile */
    .alert {
        flex-direction: column;
        text-align: center;
    }
    
    .alert i {
        font-size: 2rem;
    }
    
    /* Stats Grid Mobile */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Modal Mobile */
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    /* Page Header Mobile */
    .page-header {
        padding: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .page-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .page-actions .btn {
        width: 100%;
    }
}

/* Small Mobile (iPhone SE, etc) */
@media screen and (max-width: 375px) {
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
    
    .balance-card {
        padding: 1rem;
    }
    
    .credit-card-3d,
    .credit-card-wrapper,
    .credit-card-3d-large {
        max-width: 300px;
        height: 190px;
    }
    
    .card-number,
    .card-number-display {
        font-size: 0.95rem;
        letter-spacing: 1px;
    }
}

/* Tablet Styles */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .dashboard-main {
        margin-left: 0;
    }
    
    .dashboard-sidebar {
        transform: translateX(-100%);
    }
    
    .dashboard-sidebar.active {
        transform: translateX(0);
    }
    
    .balance-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn,
    .nav-item,
    .action-card {
        min-height: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .nav-item:hover,
    .action-card:hover {
        transform: none;
    }
    
    /* Add active states for touch */
    .btn:active {
        transform: scale(0.98);
    }
    
    .action-card:active {
        opacity: 0.8;
    }
}

/* Landscape Mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .dashboard-main {
        padding-top: 70px;
    }
    
    .balance-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* High Resolution Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card-front-3d,
    .card-back-3d,
    .card-face-front,
    .card-face-back {
        box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .top-header,
    .dashboard-sidebar,
    .page-actions,
    .btn,
    .form-actions {
        display: none !important;
    }
    
    .dashboard-main {
        margin-left: 0;
        padding: 0;
    }
    
    .credit-card-3d {
        page-break-inside: avoid;
    }
}
/* Action Dropdown Fix - Solución para menús que se cortan */
.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-dropdown .dropdown-toggle {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-dropdown .dropdown-toggle:hover {
    background: #e9ecef;
}

.action-dropdown .dropdown-menu {
    position: absolute;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    min-width: 200px;
    display: none;
    z-index: 1000;
    margin-top: 0.25rem;
}

/* Clase para abrir hacia arriba */
.action-dropdown .dropdown-menu.dropup {
    bottom: 100%;
    top: auto;
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.action-dropdown:hover .dropdown-menu {
    display: block;
}

.action-dropdown .dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
}

.action-dropdown .dropdown-menu a:first-child {
    border-radius: 5px 5px 0 0;
}

.action-dropdown .dropdown-menu a:last-child {
    border-radius: 0 0 5px 5px;
}

.action-dropdown .dropdown-menu a:hover {
    background: #f8f9fa;
}

.action-dropdown .dropdown-menu a i {
    width: 18px;
    text-align: center;
}

.action-dropdown .dropdown-menu a.text-warning {
    color: #f59e0b;
}

.action-dropdown .dropdown-menu a.text-warning:hover {
    background: #fef3c7;
}