@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');
@import "variables.css";

/* ────────────────────────────────────────────────────────────────────────── 
   RESET & GLOBALS
   ──────────────────────────────────────────────────────────────────────────  */

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

/* Font Size Levels */
html[data-font-size="1"] { font-size: 14px; }
html[data-font-size="2"] { font-size: 16px; }
html[data-font-size="3"] { font-size: 18px; }
html[data-font-size="4"] { font-size: 20px; }
html[data-font-size="5"] { font-size: 22px; }

* { 
    box-sizing: border-box !important; 
    -webkit-tap-highlight-color: transparent !important; 
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important;  /* IE/Edge */
}

*::-webkit-scrollbar { 
    display: none !important; /* Chrome, Safari, Opera */
}

html, body, button, input, select, textarea { font-family: 'Cairo', sans-serif !important; }

.fas, .far, .fab, .fa { font-family: "Font Awesome 6 Free" !important; font-weight: 900 !important; }

html, body {
    margin: 0 !important;
    padding: 0 !important;
    direction: rtl !important;
    height: 100vh !important;
    height: calc(var(--vh, 1vh) * 100) !important;
    min-height: -webkit-fill-available;
    overflow: hidden !important;
    background-color: var(--bg-page) !important;
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   APP LAYOUT - Two Panel Architecture
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.app-layout {
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    overflow: hidden;
}

/* â”€â”€â”€ UPPER PANEL (Dark Block: Header + Body) â”€â”€â”€ */
.upper-panel {
    flex: 1;
    min-height: 0; /* Critical for flex overflow */
    background: var(--onboarding-lower-bg);
    color: var(--onboarding-lower-text);
    border-radius: 0 0 40px 40px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header inside the upper panel */
.upper-header {
    padding: 12px 20px;
    padding-top: env(safe-area-inset-top, 12px);
    flex-shrink: 0;
    background: transparent !important;
    border-bottom: none !important;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* â”€â”€â”€ HEADER PREMIUM (Liquid Glass Style) â”€â”€â”€ */
.upper-header {
    padding: 15px 20px;
    flex-shrink: 0;
    z-index: 100;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

/* Base Glass Style */
/* Premium Satin Element (Replacing Liquid Glass) */
.glass-element {
    background: var(--satin-bg) !important;
    backdrop-filter: var(--satin-blur) !important;
    -webkit-backdrop-filter: var(--satin-blur) !important;
    border: 1px solid var(--satin-border) !important;
    box-shadow: var(--satin-shadow) !important;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="light"] .glass-element {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* 1. Premium Logo (Right) */
.header-logo-premium {
    width: 40px; height: 40px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.3);
}

.header-logo-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

/* 2. Header Title (Center) */
.header-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: inherit !important;
    text-shadow: none;
    margin: 0;
    flex: 1;
    text-align: center;
    letter-spacing: -0.2px;
}

/* 3. Controls Group (Left) */
.header-controls { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    flex-shrink: 0; 
}

/* Modern Theme Switch */
.theme-toggle { cursor: pointer; }

.toggle-track {
    position: relative;
    width: 72px;
    height: 38px;
    border-radius: 100px;
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.05),
        0 1px 2px rgba(255, 255, 255, 0.5) !important;
    transition: all 0.4s ease;
}

[data-theme="light"] .toggle-track {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 1px 2px rgba(255, 255, 255, 0.1) !important;
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 30px;
    height: 30px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
    z-index: 2;
}

/* Invert logic to show current mode */
/* Default (Dark Mode) -> Show Sun */
.theme-toggle .toggle-thumb i::before {
    content: "\f185"; /* Sun icon */
}

/* data-theme="light" (Light Mode) -> Move thumb and show Moon */
[data-theme="light"] .theme-toggle .toggle-thumb {
    left: calc(100% - 33px);
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
    color: #fff;
}

[data-theme="light"] .theme-toggle .toggle-thumb i::before {
    content: "\f186"; /* Moon icon */
}

.header-action-btn i,
.theme-toggle .toggle-thumb i {
    color: inherit;
}

/* Notification Action Button */
.header-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 100px; /* Fully rounded to match toggle style */
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    position: relative;
}

.header-action-btn:active { transform: scale(0.92) translateY(1px); }

.btn-badge {
    display: none !important;
}

/* Chic Notification Pulse (Soft & Elegant) */
#header-notif-btn.has-notifications i {
    animation: chicNotifPulse 2.5s ease-in-out infinite;
}

:root {
    --notif-icon-base: #1c1c1e; /* Dark Mode (Header is Light) -> Noir */
    --notif-icon-glow: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] {
    --notif-icon-base: #ffffff; /* Light Mode (Header is Dark) -> Blanc */
    --notif-icon-glow: rgba(255, 255, 255, 0.4);
}

body.view-connexion {
    --notif-icon-base: #ffffff !important;
}

@keyframes chicNotifPulse {
    0%, 100% { 
        color: var(--notif-icon-base); 
        filter: drop-shadow(0 0 5px var(--notif-icon-glow));
        transform: scale(1);
    }
    50% { 
        color: #ff3b30; /* More vibrant red for visibility */
        filter: drop-shadow(0 0 15px rgba(255, 59, 48, 0.6));
        transform: scale(1.15);
    }
}


/* Scrollable content inside upper panel */
#view-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 0;
}

/* â”€â”€â”€ APP ACTION BLOCK (Authenticated - mirrors connexion's action block) â”€â”€â”€ */
.app-action-block {
margin: 16px;
    flex: 0 0 auto !important;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 8px);
    height: auto !important;
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 150;
    background: transparent !important;
    color: var(--onboarding-upper-text);
    border-radius: 17px;
    overflow: hidden;
    box-shadow: none !important;
}

/* Initial state: navbar visible */
.app-action-block .action-initial-state {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 100px;
    opacity: 1;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

/* Expanded state: add form (hidden by default) */
.app-action-block .action-expanded-state {
    display: flex;
    flex-direction: column;
    padding: 0;

    max-height: 0;
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    transition: 
        max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.4s ease,
        transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden; /* Prevent container from scrolling */
    pointer-events: none;
}


body.add-expanded .app-action-block .action-initial-state { 
    max-height: 0;
    opacity: 0;
    padding: 0;
    pointer-events: none;
}

body.add-expanded .app-action-block .action-expanded-state { 
    max-height: 75vh;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    /* Removed delay to prevent layout jump */
}

/* Glass inputs styling for action-block forms */
.app-action-block .liquid-glass-input {
    background: var(--onboarding-lower-input) !important;
    border: 1px solid var(--onboarding-lower-border) !important;
}

.app-action-block .liquid-glass-input input {
    color: var(--onboarding-lower-text) !important;
}

.app-action-block .liquid-glass-input label {
    color: var(--panel-light-muted);
}

/* Navigation inside action block */
.action-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
}

.nav-item {
    color: var(--onboarding-upper-muted);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    transition: color 0.2s ease;
}

.nav-item i { font-size: 1.3rem; margin-bottom: 3px; }
.nav-item span { font-size: 0.7rem; font-weight: 800; }
.nav-item.active { color: var(--primary); }

.nav-central-action { flex: 0 0 65px; display: flex; justify-content: center; }

.nav-add-btn {
    width: 50px; height: 50px;
    background: var(--primary);
    border-radius: 17px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.5rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: none !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-add-btn:active { transform: scale(0.93); }

body.add-expanded .nav-add-btn i {
    transform: rotate(45deg);
    transition: transform 0.3s ease;
}

/* â”€â”€â”€ Hide old lower-panel (no longer used) â”€â”€â”€ */
.lower-panel { display: none !important; }

/* Connexion page: Slider & Flex transition */
html[data-theme] body.view-connexion, 
html[data-theme] body.view-connexion .app-layout {
    background: var(--onboarding-lower-bg) !important;
}

body.view-connexion .app-action-block { display: none !important; }

body.view-connexion .app-layout {
    padding: 0; /* No padding on login to allow full-width bottom block */
    gap: 0;
}

body.view-connexion .upper-panel {
    transition: all 0.7s cubic-bezier(0.19, 1, 0.22, 1);
    flex: 1;
    border-radius: 0 0 40px 40px;
    background: var(--onboarding-upper-bg);
}

body.view-connexion .header-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--onboarding-upper-text);
    opacity: 0.8;
}

body.view-connexion .header-logo-premium {
    background: var(--primary);
}

body.view-connexion .header-notif-btn, 
body.view-connexion .theme-toggle {
    color: var(--onboarding-upper-text);
}

body.view-connexion .upper-header {
    background: transparent !important;
    border-bottom: none !important;
    padding: 10px 20px;
}


body.view-connexion #view-container {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
}

/* â•â•â• JUSTICE WIZARD (NEW STACKED DESIGN) â•â•â• */
.wizard-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 5px 0;
    direction: rtl;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.justice-wizard-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.wizard-header {
    margin-bottom: 25px;
    flex-shrink: 0;
}

.wizard-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.wizard-cancel-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

[data-theme="light"] .wizard-cancel-btn {
    color: #1c1c1e;
}

.wizard-cancel-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

.wizard-progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

[data-theme="light"] .wizard-progress-container {
    background: rgba(0, 0, 0, 0.05);
}

.wizard-progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 15px var(--primary-glow);
}

.wizard-title {
    font-family: 'Cairo', sans-serif;
    font-weight: 900;
    font-size: 1.3rem;
    color: #fff;
    margin: 0;
    text-align: center;
    flex: 1;
}

[data-theme="light"] .wizard-title {
    color: #1c1c1e;
}

.wizard-instruction {
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #8e8e93;
    margin-bottom: 25px;
    text-align: center;
}

[data-theme="light"] .wizard-instruction {
    color: #636366;
}

.step-content {
    display: none;
}

.step-content.active {
    display: block;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none; /* Hide scrollbar Firefox */
    -ms-overflow-style: none; /* Hide scrollbar IE/Edge */
    animation: wizardStepIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-content.active::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

/* Vertical Stack - Category Selection */
.category-selection-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-card-horizontal {
    background: #1c1c1e !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 20px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

[data-theme="light"] .category-card-horizontal {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.category-card-horizontal .cat-info strong {
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
}

[data-theme="light"] .category-card-horizontal .cat-info strong {
    color: #1c1c1e;
}

.cat-icon-wrapper {
    width: 44px;
    height: 44px;
    background: #2c2c2e;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="light"] .cat-icon-wrapper {
    background: #f2f2f7;
}

.cat-icon-wrapper i {
    font-size: 1.4rem;
    color: var(--primary);
}

.category-card-horizontal:active {
    transform: scale(0.98);
    background: #3a3a3c !important;
}

.category-card-horizontal.active {
    background: rgba(var(--primary-rgb), 0.1) !important;
    border: 1px solid var(--primary) !important;
    box-shadow: none !important;
}

.category-card-horizontal.active .cat-info strong {
    color: var(--primary) !important;
}

.category-card-horizontal.active .cat-icon-wrapper {
    background: var(--primary);
}

.category-card-horizontal.active .cat-icon-wrapper i {
    color: #fff !important;
}

/* Light mode override for active state */
[data-theme="light"] .category-card-horizontal.active {
    background: rgba(var(--primary-rgb), 0.05) !important;
}

[data-theme="light"] .category-card-horizontal.active .cat-info strong {
    color: var(--primary) !important;
}

/* Removed redundant light mode overrides to maintain unified active look */

/* Option Grid (Other steps) */
.option-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.option-card {
    background: #2c2c2e !important;
    border: 1px solid transparent !important;
    border-radius: 20px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
}

.option-card span {
    font-weight: 800;
    font-size: 1rem;
}

[data-theme="light"] .option-card {
    background: #ffffff !important;
    color: #1c1c1e !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.option-card.active {
    background: rgba(var(--primary-rgb), 0.1) !important;
    color: var(--primary) !important;
    border: 1px solid var(--primary) !important;
    box-shadow: none !important;
}

[data-theme="light"] .option-card.active {
    background: rgba(var(--primary-rgb), 0.05) !important;
    color: var(--primary) !important;
}

/* Liquid Glass Inputs - Wizard Version */
.digital-input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 5px;
}

/* Wizard Glass Inputs - Isolated from Onboarding */
.wizard-glass-input {
    position: relative;
    background: #1c1c1e !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 20px;
    height: 80px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.wizard-glass-input input {
    position: relative;
    z-index: 5;
    width: 100%;
    height: 100%;
    padding: 32px 20px 12px 20px !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #fff !important;
    font-family: 'Cairo', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    text-align: right;
    direction: rtl;
}

.wizard-glass-input label {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #636366;
    font-family: 'Cairo', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 6;
}

.wizard-glass-input input:focus ~ label,
.wizard-glass-input input:not(:placeholder-shown) ~ label {
    top: 18px;
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--primary);
}

.wizard-glass-input:focus-within {
    background: #232326 !important;
    border-color: var(--primary) !important;
}

/* Theme-specific overrides for wizard inputs */
[data-theme="light"] .wizard-glass-input {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .wizard-glass-input input {
    color: #1c1c1e !important;
}

[data-theme="light"] .wizard-glass-input label {
    color: #8e8e93;
}

[data-theme="light"] .wizard-glass-input:focus-within {
    background: #fff !important;
}

/* Verification Step Status - Premium Glassmorphism */
.wizard-instruction-status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    text-align: center;
}

/* Success State Dashboard */
.status-box-found {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

/* Error State Dashboard */
.status-box-error {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    animation: dashboardShake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

/* Warning State Dashboard */
.status-box-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

@keyframes dashboardShake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.status-content-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#add-status-text {
    font-family: 'Cairo', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff !important;
    text-align: center;
}

[data-theme="light"] #add-status-text {
    color: #1c1c1e !important;
}

.status-dot-neutral, .status-dot-checking, .status-dot-found, .status-dot-error {
    display: none; /* Cache le dot */
}

/* Dashboard Retry Button */
.retry-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    padding: 10px 22px !important;
    border-radius: 14px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    margin-top: 15px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

[data-theme="light"] .retry-btn {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: #1c1c1e !important;
}

.retry-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.05) translateY(-2px);
}

.retry-btn i {
    transition: transform 0.6s ease;
}

.retry-btn:hover i {
    transform: rotate(180deg);
}

/* Loading Spinner for Buttons */
.wizard-submit.is-loading, #btn-login.is-loading {
    position: relative;
    pointer-events: none;
}

.btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: btn-spin 0.8s linear infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -10px;
    margin-top: -10px;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.is-loading .btn-spinner {
    display: block;
}

.is-loading .btn-text {
    visibility: hidden;
}
.external-preview-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 18px;
    margin-top: 15px;
    margin-bottom: 25px;
}

[data-theme="light"] .external-preview-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.external-preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.external-preview-row:last-child {
    border-bottom: none;
}

[data-theme="light"] .external-preview-row {
    border-bottom-color: rgba(0, 0, 0, 0.04);
}

.external-preview-row strong {
    color: #8e8e93;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
}

.external-preview-row span {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 800;
    text-align: left;
    font-family: 'Cairo', sans-serif;
}

[data-theme="light"] .external-preview-row span {
    color: #1c1c1e;
}

/* Wizard Footer */
.wizard-footer {
    display: flex;
    flex-direction: row; /* Side by side in RTL */
    gap: 12px;
    margin-top: 20px;
    flex-shrink: 0;
}

.wizard-next, .wizard-submit, .wizard-prev {
    flex: 1; /* Equal width */
    height: 64px;
    border: none !important;
    border-radius: 24px;
    font-family: 'Cairo', sans-serif;
    font-weight: 900;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wizard-next, .wizard-submit {
    background: #2c2c2e !important; /* Dark grey default */
    color: #fff !important;
}

.wizard-prev {
    background: #1c1c1e !important;
    color: #fff !important;
}

[data-theme="light"] .wizard-prev {
    background: #e5e5ea !important;
    color: #1c1c1e !important;
}

.wizard-next:not(:disabled) {
    background: var(--primary) !important;
    box-shadow: 0 10px 30px rgba(var(--primary-rgb), 0.4);
}

.wizard-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wizard-prev:active {
    transform: scale(0.96);
    opacity: 0.8;
}

@keyframes wizardStepIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* â•â•â• PREMIUM CONFIRMATION SHEET â•â•â• */
.confirm-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

.confirm-sheet-overlay.active {
    display: flex;
}

.confirm-sheet {
    width: 100%;
    max-width: 450px;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 32px 32px 0 0 !important;
    padding: 25px 30px 40px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    direction: rtl;
}

.confirm-sheet-overlay.active .confirm-sheet {
    transform: translateY(0);
}

.confirm-content {
    text-align: center;
}

.confirm-icon {
    width: 60px;
    height: 60px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.5rem;
}

.confirm-title {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 900;
    margin-bottom: 12px;
}

.confirm-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.confirm-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-confirm-yes {
    width: 100%;
    height: 56px;
    background: #ef4444 !important;
    color: #fff !important;
    border: none;
    border-radius: 16px;
    font-weight: 900;
    font-size: 1rem;
    cursor: pointer;
}

.btn-confirm-no {
    width: 100%;
    height: 56px;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}


/* ─── SPECIAL HANDLING: LOGIN PAGE OVERHAUL ─── */
body.view-connexion,
body.view-connexion .app-layout {
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible !important;
}

body.view-connexion .upper-panel {
    display: none !important; /* Entirely hide upper-panel if it still exists in shell */
}

body.view-connexion .onboarding-bg-mesh {
    display: none !important;
}

body.view-connexion .app-layout {
    background: var(--bg-page);
}

body.view-connexion #view-container {
    flex: 1;
    overflow: auto !important; /* Allow natural scrolling */
    padding: 0 !important;
}

/* ─── SUPREME HEADER FIX ─── */
body.view-connexion .upper-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: transparent !important;
    z-index: 1000;
}

body.view-connexion .login-arabic-title {
    text-align: left !important;
    padding-left: 10px;
}

body.view-connexion .header-title {
    color: #fff !important;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

body.view-connexion .header-action-btn {
    background: rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: blur(25px) url(#liquid-filter) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
}

body.view-connexion .header-action-btn i {
    color: #fff !important;
}

body.view-connexion .header-logo-premium {
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.3));
}

body.view-connexion #header-notif-btn,
body.view-connexion #mypwa-header-install {
    display: none !important;
}

/* ─── LEGAL PAGES STYLING ─── */
.legal-content-wrapper {
    padding: 0 5px 30px;
    color: var(--panel-light-text, #1c1c1e);
    line-height: 1.8;
}

[data-theme="dark"] .legal-content-wrapper {
    color: #fff;
}

.legal-content-wrapper h2 {
    color: var(--primary);
    font-size: 1.3rem;
    font-weight: 800;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.2);
    padding-bottom: 8px;
}

.legal-content-wrapper h2:first-child {
    margin-top: 10px;
}

.legal-content-wrapper p {
    font-size: 1rem;
    margin-bottom: 15px;
    text-align: justify;
}

.legal-content-wrapper ul {
    margin-bottom: 20px;
    padding-right: 20px; /* RTL padding */
}

.legal-content-wrapper li {
    margin-bottom: 10px;
}
    font-size: 0.85rem;
    font-weight: 700;
}

.pulse-icon {
    font-size: 1.1rem;
    animation: alertPulse 2s infinite;
}

.alert-action-btn {
    background: #fff;
    color: #b45309;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.alert-action-btn:active {
    transform: scale(0.95);
}

@keyframes slideDownAlert {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

@keyframes alertPulse {
.confirm-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-confirm-yes {
    width: 100%;
    height: 56px;
    background: #ef4444 !important;
    color: #fff !important;
    border: none;
    border-radius: 16px;
    font-weight: 900;
    font-size: 1rem;
    cursor: pointer;
}

.btn-confirm-no {
    width: 100%;
    height: 56px;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}



.legal-content-wrapper strong {
    font-weight: 800;
}

/* ═══ Top Push Alert Bar (Premium Design) ═══ */
.mypwa-top-alert {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.95) 0%, rgba(180, 83, 9, 0.98) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: 0; /* Let inner container handle padding */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideDownAlert 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.alert-container-inner {
    padding: 12px 18px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.alert-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.alert-close-btn:hover {
    color: #fff;
}

.mypwa-top-alert .alert-content {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.pulse-icon {
    font-size: 1.2rem;
    color: #ffd978;
    filter: drop-shadow(0 0 5px rgba(255, 217, 120, 0.5));
    animation: alertPulsePremium 2s infinite ease-in-out;
}

.alert-action-btn {
    background: #fff;
    color: #b45309;
    border: none;
    padding: 8px 18px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.alert-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.18);
    background: #fff;
}

.alert-action-btn:active {
    transform: scale(0.94) translateY(0);
}

@keyframes slideDownAlert {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes alertPulsePremium {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255, 217, 120, 0.3)); }
    50% { transform: scale(1.15) rotate(10deg); filter: drop-shadow(0 0 10px rgba(255, 217, 120, 0.6)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255, 217, 120, 0.3)); }
}

/* Adjust app-layout to not overlap or leave gap */
.app-layout {
    position: relative;
}

/* ═══ Push Auth Section Styling ═══ */
#push-auth-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    width: 100%;
}

.auth-warning-box {
    display: flex;
    align-items: center;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.2);
    padding: 10px 15px;
    border-radius: 12px;
    gap: 12px;
    width: 100%;
}

.auth-warning-icon {
    color: #ff3b30;
    font-size: 1.1rem;
    animation: alertShake 2s infinite;
}

.auth-warning-text {
    font-size: 0.75rem;
    color: #ff3b30;
    font-weight: 700;
}

@keyframes alertShake {
    0%, 100% { transform: rotate(0); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-5deg); }
    20%, 40%, 60%, 80% { transform: rotate(5deg); }
}
