/* ===========================================================
   FLASH RABAIS - Styles unifiés
   Fusion de base.css et index.css
   =========================================================== */

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

:root {
    /* Couleurs principales */
    --primary-color: #0f172a;
    --primary-dark: #020617;
    --primary-light: #334155;
    --secondary-color: #3b82f6;
    --accent-color: #10b981;
    
    /* Texte */
    --text-dark: #0f172a;
    --text-light: #64748b;
    --color-strong: #111827;
    --color-muted: #6b7280;
    
    /* Backgrounds */
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --color-bg: #f7f7f7;
    --color-surface: #ffffff;
    
    /* Bordures */
    --border-color: #e2e8f0;
    --color-border: #e6e9ee;
    
    /* Status colors */
    --success-color: #10b981;
    --error-color: #ef4444;
    --color-success-bg: #e8f5e9;
    --color-success-fg: #1b5e20;
    --color-success-border: #c8e6c9;
    --color-error-bg: #ffebee;
    --color-error-fg: #b71c1c;
    --color-error-border: #ffcdd2;
    
    /* Blues pour compatibilité */
    --color-primary: #0078d7;
    --color-primary-700: #005fa3;
    --color-th-bg: #f5fbff;
    --color-card-header: #fbfdff;
    --color-current-bg: #f3f3f3;
    
    /* Espacements */
    --sp-sm: 0.5rem;
    --sp-md: 1rem;
    --sp-lg: 1.5rem;
    --radius: 0.5rem;
    --max-width: 1200px;
    
    /* Typographie */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --heading-font-weight: 700;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ==========================
   Typography & Global Layout
   ========================== */
html {
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    margin: 0;
    background: linear-gradient(to bottom, #f8fafc 0%, #e2e8f0 100%);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Headings */
h1, h2, h3, h4 {
    color: var(--text-dark);
    margin: 0 0 0.5rem 0;
    font-weight: var(--heading-font-weight);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

/* Links */
a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover,
a:focus {
    color: var(--color-primary-700);
    text-decoration: underline;
}

/* ==========================
   Header Banner & Navigation
   ========================== */
.header-banner {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-dark);
    padding: 1.25rem 2rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.site-title .icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Burger Menu Button */
.burger-btn {
    background: transparent;
    border: none;
    font-size: 1.75rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.burger-btn:hover {
    background: var(--bg-light);
}

.burger-icon {
    display: block;
    width: 24px;
    height: 24px;
    line-height: 24px;
}

/* Login Button */
.login-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.login-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.login-icon {
    font-size: 1.125rem;
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: var(--bg-white);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.side-menu.open {
    left: 0;
}

.side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.side-menu-header h2 {
    font-size: 1.25rem;
    color: var(--text-dark);
}

.close-menu-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.close-menu-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.menu-list {
    list-style: none;
    padding: 1rem 0;
}

.menu-list li {
    margin: 0;
}

.menu-list a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.menu-list a:hover {
    background: var(--bg-light);
    color: var(--secondary-color);
}

.menu-separator {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 1rem;
}

.menu-section-title {
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ==========================
   Buttons
   ========================== */
.btn {
    display: inline-block;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-outline {
    background: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-light);
    border-color: var(--secondary-color);
}

.try-it-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3), 0 2px 4px -1px rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
    margin-top: 2rem;
}

.try-it-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4), 0 4px 6px -2px rgba(59, 130, 246, 0.3);
    background: #2563eb;
}

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

/* ==========================
   Cards & Containers
   ========================== */
.main-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem 2rem;
}

.container {
    max-width: var(--max-width);
    margin: 1.5rem auto;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
}

.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--color-card-header);
    font-weight: 600;
    border-radius: 12px 12px 0 0;
}

.card-body {
    padding: 1rem;
}

.card-narrow {
    max-width: 720px;
}

/* ==========================
   Hero Section
   ========================== */
.hero-section {
    background: var(--bg-white);
    border-radius: 24px;
    padding: 4rem 3rem;
    box-shadow: var(--shadow-xl);
    margin-bottom: 3rem;
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.illustration-placeholder {
    width: 100%;
    max-width: 600px;
    height: 350px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 20px;
    margin: 2rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

/* ==========================
   Upload Section
   ========================== */
.upload-section {
    background: var(--bg-white);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow-xl);
    margin-bottom: 3rem;
    display: none;
    animation: fadeInUp 0.6s ease-out;
}

.upload-section.visible {
    display: block;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    text-align: center;
}

.dropzone,
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-light);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.dropzone:hover,
.drop-zone:hover {
    border-color: var(--secondary-color);
    background: #f0f9ff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.dropzone.drag-over,
.drop-zone.dragover {
    border-color: var(--accent-color);
    background: #f0fdf4;
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.dropzone-icon {
    font-size: 3.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.dropzone-text {
    font-size: 1.25rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.dropzone-subtext {
    font-size: 1rem;
    color: var(--text-light);
}

#fileInput {
    display: none;
}

.file-list {
    margin-top: 2rem;
    display: none;
    list-style: none;
    padding: 0;
}

.file-list.visible {
    display: block;
}

.file-item {
    background: var(--bg-light);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: #f3f4f6;
    transform: translateX(5px);
}

.file-name {
    font-weight: 500;
    color: var(--text-dark);
}

.file-size {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-left: 1rem;
}

.remove-file {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.remove-file:hover {
    background: #dc2626;
}

.upload-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3), 0 2px 4px -1px rgba(16, 185, 129, 0.2);
    transition: all 0.3s ease;
    margin-top: 2rem;
    width: 100%;
    max-width: 300px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4), 0 4px 6px -2px rgba(16, 185, 129, 0.3);
    background: #059669;
}

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

/* ==========================
   Results Section
   ========================== */
.results-section {
    background: var(--bg-white);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow-xl);
    display: none;
    animation: fadeInUp 0.6s ease-out;
}

.results-section.visible {
    display: block;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}

.results-table th {
    background: var(--text-dark);
    color: white;
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-table th:first-child {
    border-radius: 12px 0 0 0;
}

.results-table th:last-child {
    border-radius: 0 12px 0 0;
}

.results-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9375rem;
}

.results-table tr:hover {
    background: var(--bg-light);
}

.discount-badge {
    background: #dcfce7;
    color: #166534;
    padding: 0.375rem 0.875rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8125rem;
    border: 1px solid #bbf7d0;
}

/* ==========================
   Email Notification
   ========================== */
.email-notification {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.email-notification-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
}

.email-notification-icon {
    font-size: 1.5rem;
}

.email-notification-text {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.email-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.email-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9375rem;
    background: var(--bg-white);
    transition: all 0.3s ease;
}

.email-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.email-input::placeholder {
    color: #94a3b8;
}

.email-subscribe-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.875rem 1.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.email-subscribe-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

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

.email-success-message {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #166534;
    font-size: 0.875rem;
    font-weight: 500;
}

.email-success-message.visible {
    display: flex;
}

/* ==========================
   Forms
   ========================== */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
    background: var(--bg-white);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type="submit"],
button[type="submit"] {
    cursor: pointer;
}

.form-default {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-control-plaintext {
    display: block;
    width: 100%;
    padding: 0.45rem 0.6rem;
    color: var(--text-dark);
    background: transparent;
    border-radius: 8px;
    box-sizing: border-box;
}

.is-invalid {
    border-color: var(--error-color) !important;
}

/* ==========================
   Tables
   ========================== */
table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

th {
    background: var(--color-th-bg);
    font-weight: 700;
    color: var(--text-dark);
}

.row-disabled {
    background: rgba(0, 0, 0, 0.02);
    opacity: 0.95;
}

.row-disabled td {
    color: var(--color-muted);
}

/* ==========================
   Loading Spinner
   ========================== */
.loading-spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
    display: none;
}

.loading-spinner.visible {
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================
   Badges & Tags
   ========================== */
.badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    vertical-align: middle;
}

.badge-admin {
    background: var(--text-dark);
    color: #fff;
}

.tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background: #eef;
    margin-left: 6px;
    font-size: 12px;
}

/* ==========================
   Utilities
   ========================== */
.mt-1 { margin-top: 1rem !important; }
.mt-2 { margin-top: 2rem !important; }
.mb-1 { margin-bottom: 1rem !important; }
.m-0 { margin: 0 !important; }
.text-muted { color: var(--color-muted) !important; }
.text-center { text-align: center !important; }
.center { margin-left: auto; margin-right: auto; }
.neg { color: var(--error-color); }

.btn-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    gap: 0.5rem;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ==========================
   Toasts
   ========================== */
.toast-container {
    position: fixed;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
}

.toast {
    background: #333;
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0.95;
}

.toast.error {
    background: var(--error-color);
}

/* ==========================
   Sections (pour page mission)
   ========================== */
.section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.section h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.section ul,
.section ol {
    padding-left: 1.5rem;
}

.section li {
    margin-bottom: 0.5rem;
}

.faq-item {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.faq-question {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.faq-answer {
    color: var(--text-light);
}

/* ==========================
   Accessibility Focus Styles
   ========================== */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(59, 130, 246, 0.18);
    outline-offset: 2px;
}

@supports(selector(:focus-visible)) {
    a:focus { outline: none; }
    a:focus-visible,
    button:focus-visible,
    input:focus-visible {
        outline: 3px solid rgba(59, 130, 246, 0.22);
        outline-offset: 2px;
    }
}

/* ==========================
   Responsive Design
   ========================== */
@media (max-width: 1024px) {
    .container {
        max-width: 900px;
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 0;
    }

    .main-container {
        padding: 1.5rem 1rem;
    }

    .container {
        margin: 1rem;
        padding: 1rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-section {
        padding: 2rem 1.5rem;
    }

    .upload-section,
    .results-section {
        padding: 2rem 1.5rem;
    }

    .site-title {
        font-size: 1.125rem;
    }

    .site-title .icon {
        font-size: 1.5rem;
    }

    .login-text {
        display: none;
    }

    .login-btn {
        padding: 0.5rem 0.75rem;
    }

    .results-stats {
        grid-template-columns: 1fr;
    }

    .email-input-group {
        flex-direction: column;
    }

    .email-subscribe-btn {
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .btn-row {
        flex-direction: column;
    }
}

/* ==========================
   Print Styles
   ========================== */
@media print {
    .header-banner,
    .burger-btn,
    .login-btn,
    .side-menu,
    .menu-overlay,
    .try-it-btn,
    .upload-btn,
    .email-notification {
        display: none !important;
    }

    body {
        background: white;
    }

    .main-container,
    .container,
    .hero-section,
    .upload-section,
    .results-section {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===========================================================
   AR SCANNER - Scanner de factures avec réalité augmentée
   =========================================================== */

/* Container principal - plein écran */
.ar-scanner-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
}

/* Header AR */
.ar-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
    z-index: 10;
}

.ar-back-btn,
.ar-flash-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.ar-back-btn:hover,
.ar-flash-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.ar-flash-btn.active {
    background: var(--accent-color);
    color: white;
}

.ar-title {
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin: 0;
}

/* Container vidéo */
.ar-video-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#arVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay AR */
.ar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Zone de scan */
.ar-scan-zone {
    position: relative;
    width: 85%;
    max-width: 400px;
    height: 120px;
    border: 3px solid rgba(255,255,255,0.6);
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    transition: all 0.3s ease;
}

.ar-scan-zone.detected {
    border-color: var(--accent-color);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5),
                inset 0 0 30px rgba(16, 185, 129, 0.1);
}

/* Coins décoratifs */
.ar-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: white;
    border-style: solid;
    border-width: 0;
}

.ar-corner-tl {
    top: -3px;
    left: -3px;
    border-top-width: 4px;
    border-left-width: 4px;
    border-top-left-radius: 12px;
}

.ar-corner-tr {
    top: -3px;
    right: -3px;
    border-top-width: 4px;
    border-right-width: 4px;
    border-top-right-radius: 12px;
}

.ar-corner-bl {
    bottom: -3px;
    left: -3px;
    border-bottom-width: 4px;
    border-left-width: 4px;
    border-bottom-left-radius: 12px;
}

.ar-corner-br {
    bottom: -3px;
    right: -3px;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-bottom-right-radius: 12px;
}

.ar-scan-zone.detected .ar-corner {
    border-color: var(--accent-color);
}

/* Ligne de scan animée */
.ar-scan-line {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--secondary-color) 20%, 
        var(--secondary-color) 80%, 
        transparent);
    border-radius: 2px;
    opacity: 0;
    top: 50%;
    transform: translateY(-50%);
}

.ar-scan-line.scanning {
    opacity: 1;
    animation: scanMove 2s ease-in-out infinite;
}

@keyframes scanMove {
    0%, 100% { top: 10%; }
    50% { top: 90%; }
}

.ar-scan-zone.detected .ar-scan-line {
    background: linear-gradient(90deg, 
        transparent, 
        var(--accent-color) 20%, 
        var(--accent-color) 80%, 
        transparent);
    animation: none;
    top: 50%;
}

/* Instructions */
.ar-instructions {
    position: absolute;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    padding: 1rem;
}

.ar-instructions i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
    opacity: 0.8;
}

.ar-instructions p {
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 0.25rem 0;
}

.ar-instructions small {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Feedback de détection */
.ar-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--accent-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
}

.ar-feedback.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.ar-feedback-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.ar-feedback-content i {
    font-size: 1.5rem;
}

/* Panneau de résultats */
.ar-results-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    padding: 1.5rem;
    max-height: 45vh;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
    z-index: 15;
}

.ar-results-header h2 {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 500;
    margin: 0 0 1rem 0;
    text-align: center;
}

/* Affichage du numéro membre */
.ar-member-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--bg-light);
    border-radius: 16px;
    margin-bottom: 1rem;
}

.ar-member-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.ar-member-number {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    letter-spacing: 2px;
    color: var(--text-dark);
}

.ar-member-number .ar-placeholder {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-light);
    letter-spacing: normal;
}

.ar-number-value {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Statut de confiance */
.ar-member-status {
    font-size: 0.875rem;
}

.ar-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.ar-status-high {
    background: var(--color-success-bg);
    color: var(--color-success-fg);
}

.ar-status-medium {
    background: #fff3cd;
    color: #856404;
}

.ar-status-low {
    background: var(--color-error-bg);
    color: var(--color-error-fg);
}

/* Historique */
.ar-history {
    margin-bottom: 1rem;
}

.ar-history h3 {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ar-history ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ar-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-light);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.ar-history-item:hover {
    background: #e8f4fc;
}

.ar-history-item.latest {
    border-color: var(--secondary-color);
    background: #e8f4fc;
}

.ar-history-number {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 600;
    color: var(--text-dark);
}

.ar-history-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

.ar-history-confidence {
    background: rgba(59, 130, 246, 0.1);
    color: var(--secondary-color);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-weight: 500;
}

.ar-history-empty {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    padding: 1rem;
}

/* Boutons actions */
.ar-actions {
    display: flex;
    gap: 0.75rem;
}

.ar-btn {
    flex: 1;
    padding: 0.875rem 1rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

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

.ar-btn-primary {
    background: linear-gradient(135deg, var(--secondary-color), #2563eb);
    color: white;
}

.ar-btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.ar-btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.ar-btn-secondary:not(:disabled):hover {
    background: #e8f4fc;
}

.ar-btn-secondary.success {
    background: var(--color-success-bg);
    color: var(--color-success-fg);
    border-color: var(--color-success-border);
}

/* Loading OCR */
.ar-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    color: white;
    text-align: center;
    gap: 1rem;
}

.ar-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ar-loading p {
    font-size: 1rem;
    margin: 0;
}

.ar-loading small {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Erreur caméra */
.ar-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    color: white;
    text-align: center;
    padding: 2rem;
    gap: 1rem;
}

.ar-error i {
    font-size: 4rem;
    opacity: 0.5;
}

.ar-error h2 {
    color: white;
    font-size: 1.5rem;
    margin: 0;
}

.ar-error p {
    color: rgba(255,255,255,0.7);
    margin: 0;
    max-width: 300px;
}

/* Mode Toggle - Header Actions */
.ar-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ar-mode-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: white;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.ar-mode-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.02);
}

.ar-mode-btn.active {
    background: linear-gradient(135deg, var(--accent-color), #f59e0b);
    border-color: transparent;
}

.ar-mode-btn i {
    font-size: 0.875rem;
}

/* Panneau lignes de facture */
.ar-invoice-lines {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 300px);
    background: white;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 30;
    overflow: hidden;
    display: none;
    flex-direction: column;
    animation: slideDown 0.3s ease;
}

.ar-invoice-lines.visible {
    display: flex;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ar-invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.ar-invoice-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ar-invoice-header h3 i {
    color: var(--accent-color);
}

.invoice-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ar-reset-invoice {
    padding: 0.5rem 0.875rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.ar-reset-invoice:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Contenu facture */
.ar-invoice-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    max-height: 350px;
}

.invoice-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.invoice-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.875rem 1rem;
    background: var(--bg-light);
    border-radius: 12px;
    transition: all 0.2s ease;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.invoice-item:hover {
    background: #e8f4fc;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-details {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-light);
}

.item-code {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    background: rgba(59, 130, 246, 0.1);
    color: var(--secondary-color);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.item-qty {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.item-qty i {
    font-size: 0.625rem;
    opacity: 0.6;
}

.item-price {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1rem;
    white-space: nowrap;
    margin-left: 1rem;
}

/* Totaux facture */
.invoice-totals {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px dashed var(--border-color);
}

.total-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
}

.total-line.subtotal {
    color: var(--text-light);
}

.total-line.tax {
    color: var(--text-light);
    font-size: 0.875rem;
}

.total-line.tax .total-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.total-line.tax .tax-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
}

.total-line.grand-total {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--primary-color);
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary-color);
}

.total-line.grand-total .total-value {
    font-size: 1.375rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Info facture (date, magasin) */
.invoice-info {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f0f9ff;
    border-radius: 10px;
}

.invoice-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-light);
}

.invoice-info-item i {
    color: var(--secondary-color);
}

.invoice-info-item strong {
    color: var(--text-dark);
}

/* État vide facture */
.invoice-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
}

.invoice-empty i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.invoice-empty p {
    margin: 0;
    font-size: 0.9375rem;
}

.invoice-empty small {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    opacity: 0.7;
}

/* Actions facture */
.ar-invoice-actions {
    display: none;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 16px;
    margin-top: 0.75rem;
}

.ar-invoice-actions.visible {
    display: flex;
}

.ar-invoice-actions .ar-btn {
    flex: 1;
}

.ar-btn-export {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
}

.ar-btn-export:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.ar-btn-save {
    background: linear-gradient(135deg, var(--accent-color), #f59e0b);
    color: white;
}

.ar-btn-save:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Mode indicator */
.ar-mode-indicator {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    color: white;
    font-size: 0.8125rem;
    font-weight: 500;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ar-mode-indicator.visible {
    opacity: 1;
}

.ar-mode-indicator.mode-member {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(37, 99, 235, 0.9));
}

.ar-mode-indicator.mode-invoice {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.9));
}

/* Responsive ajustements */
@media (max-height: 700px) {
    .ar-results-panel {
        max-height: 40vh;
    }
    
    .ar-instructions {
        bottom: 180px;
    }
    
    .ar-member-display {
        padding: 1rem;
    }
    
    .ar-member-icon {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
    
    .ar-member-number {
        font-size: 1.5rem;
    }
    
    .ar-invoice-lines {
        max-height: calc(100vh - 250px);
    }
    
    .ar-invoice-content {
        max-height: 250px;
    }
}

@media (min-width: 768px) {
    .ar-results-panel {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 24px;
        bottom: 1rem;
    }
    
    .ar-scan-zone {
        height: 140px;
    }
    
    .ar-invoice-lines {
        max-width: 600px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        border-radius: 0 0 24px 24px;
    }
    
    .invoice-item {
        padding: 1rem 1.25rem;
    }
    
    .item-name {
        font-size: 1rem;
    }
}

/* ==========================
   FOOTER STYLES
   ========================== */
.footer-banner {
    text-align: center;
    padding: 2rem;
    background: var(--surface-color, #fff);
    margin-top: 3rem;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

.footer-banner p {
    margin: 0;
    color: var(--text-light, #64748b);
    font-size: 0.9rem;
}
