/* =========================================================
   CARTHA DESIGN SYSTEM - GLASSMORPHISM (Neo-Brutalism Hybrid)
   ========================================================= */

:root {
  /* HSL Colors: Modern NeoBank Vibe */
  --c-primary: 263, 70%, 50%;     /* Vibrant Purple */
  --c-primary-light: 263, 70%, 65%;
  --c-secondary: 320, 80%, 55%;   /* Magenta Pink Accent */
  
  --c-bg: 220, 15%, 10%;          /* Dark Navy / Almost Black */
  --c-surface: 220, 15%, 15%;     /* Lighter Dark for solid cards */
  --c-text: 0, 0%, 98%;           /* Off White */
  --c-text-muted: 220, 10%, 65%;

  --c-success: 145, 65%, 45%;
  --c-danger: 350, 75%, 55%;

  /* Glassmorphism Tokens */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(16px);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

  /* Typography */
  --font-family: 'Outfit', sans-serif;
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 9999px;
}

[data-theme="light"] {
    /* Si nécessaire, inversion des couleurs ici */
}

/* =========================================================
   Reset & Base
   ========================================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: hsl(var(--c-bg));
    color: hsl(var(--c-text));
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Animated Gradient Background for maximum visual impact */
    background: 
      radial-gradient(circle at 15% 50%, rgba(105, 41, 196, 0.15) 0%, transparent 50%),
      radial-gradient(circle at 85% 30%, rgba(224, 28, 133, 0.15) 0%, transparent 50%),
      hsl(var(--c-bg));
    background-attachment: fixed;
    overflow-x: hidden;
}

#cartha-root {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* =========================================================
   Utilities
   ========================================================= */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 24px;
}

.auth-container {
    max-width: 450px; /* Centré pour le Login */
}

.dash-container {
    max-width: 1200px; /* Large pour le Dashboard Web */
}

/* Typography Utilities */
.t-h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.5px; }
.t-h2 { font-size: 1.75rem; font-weight: 600; line-height: 1.3; }
.t-body { font-size: 1rem; font-weight: 400; line-height: 1.5; color: hsl(var(--c-text-muted)); }

.t-center { text-align: center; }

/* Gradient Text */
.text-gradient {
    background: linear-gradient(135deg, hsl(var(--c-primary-light)), hsl(var(--c-secondary)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* =========================================================
   Glass Components
   ========================================================= */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

.premium-btn {
    appearance: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    color: hsl(var(--c-text));
    padding: 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-weight: 500;
    width: 100%;
}

.premium-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: hsl(var(--c-primary-light));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.premium-btn:active {
    transform: translateY(0);
}

.sub-wallet-item {
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    padding: 16px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.03);
    transition: all 0.3s ease;
}

.sub-wallet-item:hover {
    background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
    border-color: rgba(255,255,255,0.1);
}

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes floatBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.anim-float-bounce {
    animation: floatBounce 1.5s infinite ease-in-out;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hide-scrollbar::-webkit-scrollbar {
    width: 0px; 
    background: transparent; 
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.animate-fade-up {
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* =========================================================
   Forms & Buttons
   ========================================================= */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: hsl(var(--c-text));
}

.form-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: hsl(var(--c-text));
    font-family: var(--font-family);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.form-input:focus {
    border-color: hsl(var(--c-primary));
    background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.btn {
    appearance: none;
    border: none;
    border-radius: var(--radius-md);
    padding: 16px 24px;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.btn-primary {
    background: linear-gradient(135deg, hsl(var(--c-primary)), hsl(var(--c-secondary)));
    color: white;
    box-shadow: 0 4px 15px rgba(105, 41, 196, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Error messages */
.error-msg {
    color: hsl(var(--c-danger));
    font-size: 0.875rem;
    margin-top: 8px;
    display: none;
}

/* =========================================================
   Dashboard & Wallet Cards
   ========================================================= */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 24px;
}

.wallet-card-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    color: white;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}

.wallet-card-wrapper:hover {
    transform: translateY(-5px);
}

.wallet-bg-main {
    background: linear-gradient(135deg, hsl(263, 70%, 45%), hsl(263, 80%, 25%));
}
.wallet-bg-flexi {
    background: linear-gradient(135deg, hsl(320, 80%, 50%), hsl(20, 80%, 50%));
}
.wallet-bg-kids {
    background: linear-gradient(135deg, hsl(180, 80%, 40%), hsl(220, 80%, 50%));
}

.wallet-type {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.8;
}

.wallet-balance {
    font-size: 2.2rem;
    font-weight: 700;
    margin-top: 8px;
}

.chip {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 32px;
}

.action-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-md);
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: hsl(var(--c-text));
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255,255,255,0.08);
    transform: scale(1.05);
}

.action-icon {
    font-size: 1.5rem;
}

.action-label {
    font-size: 0.8rem;
    font-weight: 500;
}

/* =========================================================
   Transfer Modal Mocks & Rich Banking Elements
   ========================================================= */
.transfer-amount-input {
    width: 100%;
    background: transparent;
    border: none;
    text-align: center;
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    outline: none;
    padding: 0;
    margin: 20px 0 10px 0;
}

.transfer-amount-input::placeholder {
    color: rgba(255,255,255,0.2);
}

.currency-label {
    text-align: center;
    color: hsl(var(--c-primary));
    font-weight: 600;
    letter-spacing: 2px;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.recipient-box {
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 24px;
}

.recipient-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* =========================================================
   Responsive Breakpoints
   ========================================================= */

/* Desktop / Tablet Landscape */
@media (min-width: 768px) {
    .dashboard-layout {
        display: flex;
        flex-direction: row;
        gap: 32px;
        align-items: flex-start;
    }

    .dashboard-sidebar {
        flex: 0 0 350px;
        position: sticky;
        top: 24px;
    }

    .dashboard-main {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .action-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile */
@media (max-width: 767px) {
    .dashboard-layout {
        display: flex;
        flex-direction: column;
        gap: 24px;
        padding-bottom: 90px; /* Extra padding for bottom nav */
    }

    .mobile-fast-services {
        position: sticky !important;
        top: 10px !important;
        z-index: 1000 !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }
    
    .dashboard-main {
        display: contents; /* Removes the wrapper so children can be ordered globally */
    }
    
    .dashboard-sidebar {
        order: 2; /* Main wallets go in the middle */
    }
    
    .fast-services-desktop {
        position: fixed !important;
        bottom: 0 !important;
        top: auto !important;
        left: 0 !important;
        width: 100vw !important;
        z-index: 2000 !important;
        padding: 10px 8px !important; /* Thinner padding */
        margin: 0 !important;
        border-radius: 24px 24px 0 0 !important;
        border-bottom: none !important;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1) !important; /* Top border reflection */
        box-sizing: border-box !important;
        background: rgba(20, 25, 30, 0.85) !important; /* Slightly darker glass for contrast */
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
    }

    .fast-services-desktop h3 {
        display: none; /* Hide 'Services Rapides' title on mobile to save space */
    }

    .fast-services-desktop .action-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: hidden !important; /* Remove horizontal scrolling completely */
        gap: 0px !important;
        padding-bottom: 0px !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .fast-services-desktop .action-grid::-webkit-scrollbar {
        height: 0px; /* Hide scrollbar for a cleaner look */
    }

    .fast-services-desktop .action-btn {
        flex: 1 1 0 !important; /* Each button takes equal width */
        min-width: 0 !important; /* Allow shrinking on very small screens */
        padding: 4px 2px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
        border: none !important;
        opacity: 0.8 !important; /* Dim slightly to feel like unselected tabs */
        transition: opacity 0.2s ease !important;
    }
    
    .fast-services-desktop .action-btn:active {
        opacity: 1 !important;
        background: rgba(255,255,255,0.05) !important;
        border-radius: 12px !important;
    }

    .fast-services-desktop .action-icon {
        font-size: 1.6rem !important; /* Larger clean icon */
        margin-bottom: 4px !important;
        margin-right: 0 !important;
        background: transparent !important; /* Remove ugly bubble */
        width: auto !important;
        height: auto !important;
        display: block !important;
    }

    .fast-services-desktop .action-label {
        font-size: 0.65rem !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
        font-weight: 500 !important;
        color: rgba(255,255,255,0.8) !important;
    }
    
    .tx-list-container {
        order: 3; /* History goes to the bottom */
    }
}

/* Transaction List Mocks */
.tx-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.tx-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.05);
}

.tx-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 16px;
}

/* =========================================================
   Modal Definitions
   ========================================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s ease, opacity 0.3s ease;
}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* =========================================================
   Global Toast Notifications
   ========================================================= */
.cartha-toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
    align-items: center;
}

.cartha-toast {
    background: rgba(20, 25, 30, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid hsl(var(--c-primary-light));
    animation: toastSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: center;
}

@keyframes toastSlideDown {
    from { opacity: 0; transform: translateY(-40px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastFadeOut {
    to { opacity: 0; transform: translateY(-20px) scale(0.9); }
}

/* =========================================================
   Brand Logo System (Dynamic Theme)
   ========================================================= */
.cartha-brand-logo {
    height: 48px;
    object-fit: contain;
    transition: opacity 0.3s ease;
    transform: scale(2.8);
    transform-origin: center;
    margin: 0 24px;
}

/* By default, hide both */
.cartha-logo-light, .cartha-logo-dark {
    display: none;
}

/* When theme is Dark, show Dark logo (White text version) */
[data-theme="dark"] .cartha-logo-dark {
    display: inline-block;
}

/* When theme is Light, show Light logo (Black text version) */
[data-theme="light"] .cartha-logo-light {
    display: inline-block;
}

/* =========================================================
   Mobile Responsiveness for Headers
   ========================================================= */
@media (max-width: 768px) {
    .cartha-brand-logo {
        transform: scale(1.6) !important; /* Slightly smaller for mobile */
        margin: 0 4px !important; /* Minimal margin */
    }

    .top-nav {
        flex-direction: row !important; /* Keep it horizontal like an app header */
        align-items: center !important;
        justify-content: space-between !important;
        padding: 12px 16px !important; /* Much tighter padding */
        border-radius: 20px !important; /* Pill/Card hybrid */
        margin-bottom: 24px !important;
    }

    .top-nav > a, .top-nav [data-link] {
        display: none !important; /* Hide text buttons in header on mobile */
    }

    .top-nav > div {
        gap: 8px !important; /* Tighter gap between logo and text */
    }

    /* Target the text wrapper next to the logo */
    .top-nav > div > div[style*="border-left"] {
        border-left: none !important;
        padding-left: 8px !important;
    }

    /* Hide the subtitle ("Espace Professionnel") to save vertical/horizontal space */
    .top-nav > div > div[style*="border-left"] p:first-child {
        display: none !important;
    }
    
    .top-nav > div > div[style*="border-left"] p:last-child {
        font-size: 0.85rem !important; /* Slightly smaller user name */
    }
}

/* =========================================================
   Print Logique (PDF Invoices)
   ========================================================= */
@media print {
    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #cartha-root, .modal-overlay {
        display: none !important;
    }

    #print-area {
        display: block !important;
        width: 100% !important;
        background: white !important;
        page-break-after: always;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
