/* ============================================================================
   COMPONENTS.CSS - PARTIE 1/8 OPTIMISÉE ✅
   Chat Interface + Rappels Screen
   ANCIEN: ~600 lignes | NOUVEAU: ~380 lignes (-37%)
   ============================================================================ */

/* ============================================================================
   1. CHAT HEADER (avec bouton Rappels)
   ============================================================================ */

.chat-header {
    position: sticky;
    top: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    border: 2px solid hsl(var(--primary));
    transition: var(--transition-fast);
}

.chat-avatar:hover {
    transform: var(--hover-scale);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.chat-user-details h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: hsl(var(--primary));
    margin: 0;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-xs);
    color: hsl(var(--on-surface-variant));
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background-color: hsl(var(--error));
    animation: pulse 2s infinite;
}

.status-dot.online {
    background-color: hsl(var(--success));
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chat-actions {
    display: flex;
    gap: var(--space-2);
}

/* Bouton Rappels avec badge */
.btn-rappels {
    position: relative;
}

.rappels-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: hsl(var(--error));
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ============================================================================
   2. CHAT MESSAGES
   ============================================================================ */

.chat-messages {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.message {
    margin-bottom: var(--space-4);
    animation: fadeIn 0.3s ease-out;
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-xl);
    max-width: 85%;
    word-wrap: break-word;
    backdrop-filter: blur(15px);
    transition: var(--transition-smooth);
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border: 1px solid var(--glass-border);
    color: hsl(var(--primary));
    margin-left: auto;
    border-bottom-right-radius: var(--radius);
    box-shadow: var(--glass-shadow);
}

.ai-message .message-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: hsl(var(--on-surface));
    border-bottom-left-radius: var(--radius);
}

.message-content:hover {
    transform: translateY(-1px);
    box-shadow: var(--glass-shadow-hover);
}

.message-time {
    font-size: var(--font-size-xs);
    color: hsl(var(--on-surface-variant));
    margin-top: var(--space-1);
    text-align: right;
}

.ai-message .message-time {
    text-align: left;
}

/* TTS Button */
.tts-button {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: 24px;
    height: 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--primary));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.ai-message:hover .tts-button {
    opacity: 1;
    visibility: visible;
}

.tts-button:hover {
    background: var(--glass-bg-hover);
    transform: var(--hover-scale);
}

.tts-button.playing {
    animation: pulse 1.5s infinite;
}

/* ============================================================================
   3. CHAT INPUT
   ============================================================================ */

.chat-input-container {
    position: sticky;
    bottom: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: var(--space-4);
}

.chat-input-actions {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.chat-input-main {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
}

.chat-input-main textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: var(--space-3) var(--space-4);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    color: hsl(var(--on-surface));
    resize: none;
    font-family: inherit;
    transition: var(--transition-smooth);
    outline: none;
}

.chat-input-main textarea:focus {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
    box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.1);
}

.btn-send {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    color: hsl(var(--primary));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    box-shadow: var(--glass-shadow);
}

.btn-send:hover {
    background: linear-gradient(135deg, var(--glass-bg-hover), rgba(0, 255, 255, 0.15));
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
    box-shadow: var(--glass-shadow-hover);
}

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

/* ============================================================================
   4. ATTACHMENTS PREVIEW
   ============================================================================ */

.attachment-preview {
    padding: var(--space-2);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
}

.preview-content {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.preview-thumbnail,
.file-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.preview-thumbnail {
    object-fit: cover;
}

.file-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
}

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

.preview-name {
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: hsl(var(--on-surface));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-size {
    font-size: var(--font-size-xs);
    color: hsl(var(--on-surface-variant));
}

.preview-remove-btn {
    width: 28px;
    height: 28px;
    background: rgba(255, 0, 0, 0.1);
    color: hsl(var(--error));
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: bold;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.preview-remove-btn:hover {
    background: rgba(255, 0, 0, 0.2);
}

.message-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: var(--radius);
    cursor: pointer;
}

.message-file {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
}

/* ============================================================================
   5. RAPPELS SCREEN
   ============================================================================ */

.rappels-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

.rappels-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.rappel-group {
    margin-bottom: var(--space-6);
}

.rappel-group-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: hsl(var(--primary));
    margin-bottom: var(--space-3);
    padding-left: var(--space-2);
}

.rappel-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    transition: var(--transition-smooth);
    position: relative;
    margin-bottom: var(--space-3);
}

.rappel-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: hsl(var(--primary-light));
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
    opacity: 0;
    transition: var(--transition-smooth);
}

.rappel-card:hover {
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--glass-shadow-hover);
}

.rappel-card:hover::before {
    opacity: 1;
}

.rappel-card.passed {
    opacity: 0.6;
}

.rappel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-3);
    gap: var(--space-3);
}

.rappel-datetime {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: hsl(var(--primary-light));
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.rappel-status {
    font-size: var(--font-size-xs);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius);
    font-weight: 500;
}

.rappel-status.en_attente {
    background: rgba(230, 119, 0, 0.1);
    color: hsl(var(--primary-light));
}

.rappel-status.passe {
    background: rgba(100, 100, 100, 0.1);
    color: hsl(var(--on-surface-variant));
}

.rappel-content {
    font-size: var(--font-size-base);
    color: hsl(var(--on-surface));
    margin-bottom: var(--space-3);
    line-height: 1.5;
}

.rappel-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

.btn-delete-rappel {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-sm);
    padding: var(--space-2) var(--space-3);
    background: rgba(239, 68, 68, 0.1);
    color: hsl(var(--error));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition-smooth);
    font-weight: 500;
}

.btn-delete-rappel:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05);
}

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

/* Bouton Ajouter Rappel */
.btn-add-rappel {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: hsl(var(--success));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-add-rappel:hover {
    background: hsl(var(--success) / 0.8);
    transform: var(--hover-scale);
}

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

/* ============================================================================
   MODAL CRÉER RAPPEL - Styles améliorés pour lisibilité
   ============================================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    /* ✅ Fond blanc opaque pour lisibilité maximale */
    background: hsl(var(--surface));

    /* ✅ Bordure orange pour identité visuelle */
    border: 2px solid hsl(var(--primary-light));

    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;

    /* ✅ Ombre marquée pour le contraste */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(230, 119, 0, 0.1);

    /* ✅ Animation d'apparition */
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-3);

    /* ✅ Séparateur orange subtil */
    border-bottom: 1px solid hsl(var(--primary-light) / 0.2);
}

.modal-header h3 {
    font-size: var(--font-size-xl);
    color: hsl(var(--primary));
    font-weight: 600;
    margin: 0;
}

/* ✅ Bouton fermer la modal */
.modal-header .close-btn,
#close-create-rappel {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: hsl(var(--on-surface-variant));
    padding: 0.25rem;
    line-height: 1;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.modal-header .close-btn:hover,
#close-create-rappel:hover {
    background: hsl(var(--surface-variant));
    color: hsl(var(--primary));
}

/* ✅ Corps de la modal */
.modal-body {
    margin-bottom: var(--space-6);
}

/* ✅ Groupes de formulaire */
.form-group {
    margin-bottom: var(--space-4);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

/* ✅ Labels avec meilleure lisibilité */
.form-group label,
.modal-body label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: hsl(var(--on-surface));
    margin-bottom: var(--space-2);
}

/* ✅ Inputs et textarea avec fond clair */
.form-group input,
.form-group textarea,
.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 0.75rem;
    background: hsl(var(--surface-variant));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--on-surface));
    font-family: inherit;
    font-size: var(--font-size-base);
    transition: var(--transition-smooth);
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.modal-body input::placeholder,
.modal-body textarea::placeholder {
    color: hsl(var(--on-surface-variant));
    opacity: 0.6;
}

/* ✅ Focus state orange */
.form-group input:focus,
.form-group textarea:focus,
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: hsl(var(--primary-light));
    box-shadow: 0 0 0 3px hsl(var(--primary-light) / 0.1);
}

.form-group textarea,
.modal-body textarea {
    resize: vertical;
    min-height: 80px;
}

/* ✅ Bouton Créer le rappel - GARDE LA COULEUR ORANGE */
.btn-create-rappel,
.modal-body .btn-submit,
button[type="submit"] {
    width: 100%;
    padding: 0.75rem;
    background: hsl(var(--primary-light));
    border: none;
    border-radius: var(--radius);
    color: white;
    font-weight: 600;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-create-rappel:hover,
.modal-body .btn-submit:hover,
button[type="submit"]:hover {
    background: hsl(var(--primary));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 119, 0, 0.3);
}

.btn-create-rappel:active,
.modal-body .btn-submit:active,
button[type="submit"]:active {
    transform: translateY(0);
}

/* ✅ Scrollbar personnalisée pour modal */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: hsl(var(--surface-variant));
    border-radius: var(--radius);
}

.modal-content::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: var(--radius);
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--primary-light));
}

/* ============================================================================
   ÉTAT VIDE - Rappels
   ============================================================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    text-align: center;
    color: hsl(var(--on-surface-variant));
}

.empty-state svg {
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state p {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: hsl(var(--on-surface));
}

.empty-state small {
    font-size: var(--font-size-sm);
    opacity: 0.7;
}

/* ============================================================================
   RESPONSIVE MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .chat-header {
        padding: var(--space-3);
    }

    .chat-avatar {
        width: 40px;
        height: 40px;
    }

    .chat-messages {
        padding: var(--space-3);
    }

    .message-content {
        max-width: 90%;
        padding: var(--space-2) var(--space-3);
    }

    .chat-input-container {
        padding: var(--space-3);
    }

    .chat-input-main textarea {
        font-size: 16px;
        /* Évite zoom iOS */
    }

    .rappels-container {
        padding: var(--space-3);
    }

    .rappel-card {
        padding: var(--space-3);
    }

    .rappel-header {
        flex-direction: column;
        gap: var(--space-2);
    }
}

@media (max-width: 480px) {

    .preview-thumbnail,
    .file-icon {
        width: 40px;
        height: 40px;
    }

    .message-image {
        max-width: 120px;
        max-height: 120px;
    }

    .rappel-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* ============================================================================
   COMPONENTS.CSS - PARTIE 2/8 OPTIMISÉE ✅
   Bottom Navigation - 5 Onglets (Chat, Ventes, Dépenses, Profil, Rappels)
   ANCIEN: ~250 lignes | NOUVEAU: ~140 lignes (-44%)
   ============================================================================ */

/* ============================================================================
   1. BOTTOM NAVIGATION - STRUCTURE
   ============================================================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: var(--space-2) var(--space-2);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: 0 auto;
}

/* ============================================================================
   2. NAV ITEMS
   ============================================================================ */

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-1);
    cursor: pointer;
    transition: var(--transition-smooth);
    border-radius: var(--radius-lg);
    color: hsl(var(--on-surface-variant));
    background: none;
    border: none;
    flex: 1;
    min-width: 44px;
    min-height: 44px;
}

.nav-item:hover {
    background: var(--glass-bg-hover);
    color: hsl(var(--primary-light));
    transform: var(--hover-scale);
}

.nav-item.active {
    color: hsl(var(--primary));
    background: var(--glass-bg-hover);
    transform: var(--hover-scale);
}

.nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: var(--space-1);
    transition: var(--transition-fast);
}

.nav-item.active svg {
    transform: scale(1.1);
}

.nav-item span {
    font-size: var(--font-size-xs);
    font-weight: 500;
}

/* ============================================================================
   3. ICÔNES SPÉCIFIQUES PAR ÉCRAN
   ============================================================================ */

/* Dépenses - Icône rouge */
.nav-item[data-screen="expenses"] svg {
    color: hsl(var(--error));
}

.nav-item[data-screen="expenses"].active {
    color: hsl(var(--error));
}

.nav-item[data-screen="expenses"]:hover {
    color: rgba(239, 68, 68, 0.8);
}

/* ============================================================================
   4. SCREENS MANAGEMENT
   ============================================================================ */

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    /* ✅ MODIFIÉ - transparent pour voir le gradient du body */
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    padding-bottom: 80px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active {
    transform: translateX(0);
}

.screen.hidden {
    display: none;
}

/* Chat screen visible par défaut */
#chat-screen {
    z-index: 99;
    transform: translateX(0);
}

.screen-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

/* ============================================================================
   5. SCREEN HEADER GÉNÉRIQUE
   ============================================================================ */

.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.screen-header h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: hsl(var(--primary));
    margin: 0;
}

/* Bouton retour générique */
.btn-icon {
    width: 40px;
    height: 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--primary));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
}

/* ============================================================================
   6. ANIMATIONS DE TRANSITION
   ============================================================================ */

.screen.slide-in-right {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.screen.slide-out-right {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(100%);
    }
}

/* ============================================================================
   ANIMATIONS DE SWIPE
   ============================================================================ */

.slide-out-left {
    animation: slideOutLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-out-right {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-in-left {
    animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-in-right {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Désactiver les animations si préférences système */
@media (prefers-reduced-motion: reduce) {

    .slide-out-left,
    .slide-out-right,
    .slide-in-left,
    .slide-in-right {
        animation: none !important;
    }
}

/* ============================================================================
   7. SAFE AREAS (iOS Notch)
   ============================================================================ */

.bottom-nav {
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
    height: calc(80px + env(safe-area-inset-bottom));
}

.screen {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ============================================================================
   RESPONSIVE MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .bottom-nav {
        height: 70px;
        padding: var(--space-1) var(--space-2);
    }

    .nav-item {
        padding: var(--space-1);
    }

    .nav-item svg {
        width: 22px;
        height: 22px;
    }

    .nav-item span {
        font-size: 0.625rem;
    }

    .screen-header {
        padding: var(--space-3);
    }

    .screen-header h2 {
        font-size: var(--font-size-lg);
    }

    .screen-content {
        padding: var(--space-3);
    }
}

@media (max-width: 480px) {
    .bottom-nav {
        max-width: 100%;
        height: 65px;
    }

    .nav-item {
        min-width: 50px;
    }

    .nav-item svg {
        width: 20px;
        height: 20px;
    }

    .nav-item span {
        font-size: 0.55rem;
    }

    .screen-content {
        padding: var(--space-2);
    }
}

@media (max-width: 360px) {
    .bottom-nav {
        height: 60px;
        padding: var(--space-1);
    }

    .nav-item span {
        display: none;
        /* Cache le texte sur très petits écrans */
    }

    .nav-item {
        min-width: 40px;
    }

    .nav-item svg {
        margin-bottom: 0;
    }
}

/* ============================================================================
   8. LANDSCAPE MODE
   ============================================================================ */

@media (orientation: landscape) and (max-height: 500px) {
    .bottom-nav {
        height: 50px;
        padding: var(--space-1) var(--space-2);
    }

    .nav-item svg {
        width: 18px;
        height: 18px;
    }

    .nav-item span {
        display: none;
    }
}

/* ============================================================================
   9. REDUCED MOTION (Accessibilité)
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .screen {
        transition: none;
    }

    .nav-item.active svg {
        transform: none;
    }
}

/* ============================================================================
   COMPONENTS.CSS - PARTIE 3/8 OPTIMISÉE ✅
   Sales Screen - Formulaire de ventes avec gestion articles
   ANCIEN: ~450 lignes | NOUVEAU: ~260 lignes (-42%)
   ============================================================================ */

/* ============================================================================
   1. SALES HEADER - Bouton Stock
   ============================================================================ */

.screen-header {
    position: relative;
}

.btn-stock {
    padding: var(--space-2) var(--space-3);
    background: linear-gradient(135deg, #C19A6B, #A67C52);
    border: 1px solid #B8956A;
    border-radius: var(--radius);
    color: #FFFFFF;
    cursor: pointer;
    font-weight: 600;
    font-size: var(--font-size-sm);
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(193, 154, 107, 0.3);
    min-width: 65px;
}

.btn-stock:hover {
    background: linear-gradient(135deg, #A67C52, #8B6F47);
    border-color: #8B6F47;
    transform: var(--hover-lift);
    box-shadow: 0 8px 20px rgba(193, 154, 107, 0.5);
}

/* ============================================================================
   2. COMPACT CARDS
   ============================================================================ */

.compact-card {
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow);
    transition: var(--transition-smooth);
}

/* Card Article vendu compacte */
#sales-screen .compact-card:nth-child(3) {
    padding: var(--space-3);
    margin-bottom: var(--space-2);
}

#sales-screen .sale-form {
    gap: var(--space-1);
}

#sales-screen .form-group-inline label {
    min-width: 50px;
    font-size: var(--font-size-xs);
}

.compact-card:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--glass-shadow-hover);
    transform: translateY(-1px);
}

.compact-card h3 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: hsl(var(--on-surface));
    margin: 0 0 var(--space-3) 0;
}

/* ============================================================================
   3. DATE SELECTOR
   ============================================================================ */

.date-selector-compact {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.date-btn-compact {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    color: hsl(var(--on-surface));
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.date-btn-compact:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
}

.date-btn-compact.active {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border-color: var(--glass-border-hover);
    color: hsl(var(--primary));
    box-shadow: var(--glass-shadow);
    font-weight: 600;
}

.calendar-icon-btn-compact {
    width: 36px;
    height: 36px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--primary));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.calendar-icon-btn-compact:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
}

.date-input-compact {
    width: 100%;
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--on-surface));
    transition: var(--transition-smooth);
    outline: none;
    font-size: var(--font-size-sm);
}

.date-input-compact:focus {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.1);
}

/* ============================================================================
   4. ACCORDION - GESTION ARTICLES
   ============================================================================ */

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: var(--space-1);
    border-radius: var(--radius);
    margin-bottom: var(--space-2);
}

.accordion-header:hover {
    background: var(--glass-bg-hover);
}

.accordion-header h3 {
    margin: 0;
}

.accordion-arrow {
    color: hsl(var(--primary));
    transition: var(--transition-smooth);
    width: 16px;
    height: 16px;
}

.accordion-header.active .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.accordion-content.show {
    max-height: 300px;
    padding-top: var(--space-2);
}

/* ============================================================================
   5. ADD ARTICLE FORM
   ============================================================================ */

.input-group-simple {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.autocomplete-wrapper {
    position: relative;
    flex: 1;
}

.input-compact {
    flex: 1;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--on-surface));
    font-size: var(--font-size-sm);
    transition: var(--transition-smooth);
    outline: none;
}

.input-compact:focus {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.1);
}

.input-compact::placeholder {
    color: hsl(var(--on-surface-variant));
    font-size: var(--font-size-xs);
}

.btn-add-compact {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--primary));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    font-weight: bold;
    font-size: var(--font-size-lg);
    flex-shrink: 0;
}

.btn-add-compact:hover {
    background: linear-gradient(135deg, var(--glass-bg-hover), rgba(0, 255, 255, 0.15));
    border-color: var(--glass-border-hover);
    transform: var(--hover-scale);
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow-hover);
    max-height: 120px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: var(--space-1);
}

.autocomplete-suggestion {
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: var(--font-size-sm);
    color: hsl(var(--on-surface));
}

.autocomplete-suggestion:last-child {
    border-bottom: none;
}

.autocomplete-suggestion:hover {
    background: var(--glass-bg-hover);
    color: hsl(var(--primary));
}

/* ============================================================================
   6. AVAILABLE ARTICLES LIST
   ============================================================================ */

.available-articles-list {
    max-height: 150px;
    overflow-y: auto;
    margin-top: var(--space-2);
}

.available-article-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    transition: var(--transition-smooth);
}

.available-article-item:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
}

.article-name {
    font-weight: 500;
    color: hsl(var(--on-surface));
}

.remove-article-btn {
    padding: var(--space-1);
    background: rgba(255, 0, 0, 0.1);
    border: none;
    color: hsl(var(--error));
    cursor: pointer;
    border-radius: var(--radius-sm);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
    font-weight: bold;
}

.remove-article-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: var(--hover-scale);
}

.empty-articles {
    text-align: center;
    color: hsl(var(--on-surface-variant));
    font-style: italic;
    font-size: var(--font-size-sm);
    padding: var(--space-4);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius);
}

/* ============================================================================
   7. SALE FORM - Article vendu
   ============================================================================ */

.sale-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-group-inline label {
    font-size: var(--font-size-xs);
    color: hsl(var(--on-surface));
    font-weight: 500;
    min-width: 55px;
}

/* Prix et Quantité sur la même ligne */
.price-quantity-row {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
}

/* Alias pour compatibilité */
.article-price-quantity {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
}

.article-price-quantity .price-group {
    flex: 2;
}

.article-price-quantity .quantity-group {
    flex: 1;
    min-width: 80px;
}

.price-group {
    flex: 2;
}

.quantity-group {
    flex: 1;
    min-width: 80px;
}

.price-group label,
.quantity-group label {
    display: block;
    font-size: var(--font-size-xs);
    color: hsl(var(--on-surface));
    font-weight: 500;
    margin-bottom: var(--space-1);
}

.price-input,
.quantity-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--on-surface));
    font-size: var(--font-size-base);
    font-weight: 600;
    transition: var(--transition-smooth);
    outline: none;
    box-sizing: border-box;
}

.price-input:focus,
.quantity-input:focus {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.1);
}

/* Wrapper pour le prix avec devise */
.price-wrapper {
    position: relative;
    width: 100%;
}

.price-currency {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-xs);
    color: hsl(var(--primary));
    font-weight: 500;
    pointer-events: none;
}

.select-compact {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--on-surface));
    font-size: var(--font-size-sm);
    transition: var(--transition-smooth);
    outline: none;
}

.select-compact:focus {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.1);
}

.textarea-compact {
    width: 100%;
    height: 60px;
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--on-surface));
    font-family: inherit;
    font-size: var(--font-size-sm);
    resize: none;
    transition: var(--transition-smooth);
    outline: none;
}

.textarea-compact:focus {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.1);
}

/* ============================================================================
   8. PAYMENT & TOTAL
   ============================================================================ */

.payment-methods-compact {
    display: flex;
    gap: var(--space-2);
}

.payment-btn-compact {
    flex: 1;
    padding: var(--space-2);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    color: hsl(var(--on-surface));
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition-smooth);
    font-weight: 500;
    font-size: var(--font-size-sm);
    min-height: 40px;
}

.payment-btn-compact.active {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border-color: var(--glass-border-hover);
    color: hsl(var(--primary));
    box-shadow: var(--glass-shadow);
    font-weight: 600;
}

.payment-btn-compact:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
}

/* Total Card */
.total-card-compact {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border: 1px solid var(--glass-border-hover);
    box-shadow: var(--glass-shadow-hover);
}

.total-display-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.total-label {
    font-weight: 600;
    color: hsl(var(--on-surface));
    font-size: var(--font-size-base);
}

.total-amount {
    font-weight: 700;
    color: hsl(var(--primary));
    font-size: var(--font-size-xl);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.total-amount.updated {
    animation: totalPulse 0.5s ease;
}

@keyframes totalPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.btn-primary-compact {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    color: hsl(var(--primary));
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: var(--font-size-base);
    transition: var(--transition-smooth);
    box-shadow: var(--glass-shadow);
}

.btn-primary-compact:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--glass-bg-hover), rgba(0, 255, 255, 0.15));
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
    box-shadow: var(--glass-shadow-hover);
    color: hsl(var(--primary-light));
}

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

/* ============================================================================
   RESPONSIVE MOBILE - SALES SCREEN
   ============================================================================ */

@media (max-width: 768px) {
    .compact-card {
        padding: var(--space-3);
        margin-bottom: var(--space-2);
    }

    .date-btn-compact {
        padding: var(--space-2);
        min-height: 40px;
    }

    .calendar-icon-btn-compact {
        width: 40px;
        height: 40px;
    }

    .input-compact,
    .select-compact {
        padding: var(--space-2);
        font-size: 16px;
        /* Évite zoom iOS */
    }

    .btn-add-compact {
        width: 40px;
        height: 40px;
    }

    .accordion-content.show {
        max-height: 200px;
    }

    .available-articles-list {
        max-height: 120px;
    }

    .autocomplete-dropdown {
        max-height: 100px;
    }

    .price-input,
    .quantity-input {
        font-size: 16px;
    }

    .payment-btn-compact {
        padding: var(--space-2);
        min-height: 40px;
    }

    .btn-primary-compact {
        padding: var(--space-3);
        min-height: 44px;
    }

    .btn-stock {
        padding: var(--space-2);
        font-size: var(--font-size-xs);
        min-width: 55px;
    }
}

@media (max-width: 480px) {
    .input-group-simple {
        gap: var(--space-1);
    }
}

@media (max-width: 374px) {
    .payment-methods-compact {
        gap: var(--space-1);
    }

    .payment-btn-compact {
        font-size: 0.75rem;
        min-height: 38px;
    }
}

@media (max-width: 768px) {
    .price-quantity-row {
        display: flex;
        flex-direction: row;
        /* GARDEZ en ligne */
        gap: var(--space-2);
    }
}

@media (max-width: 768px) {
    .article-price-quantity {
        display: flex;
        gap: var(--space-2);
    }

    .article-price-quantity .price-input,
    .article-price-quantity .quantity-input {
        font-size: 16px;
        min-height: 40px;
    }
}

/* ============================================================================
   COMPONENTS.CSS - PARTIE 4/8 OPTIMISÉE ✅
   Expenses Screen - Thème Rouge avec bordures rouges
   ANCIEN: ~320 lignes | NOUVEAU: ~175 lignes (-45%)
   ============================================================================ */

/* ============================================================================
   1. EXPENSES - ICÔNE NAVIGATION (Rouge)
   ============================================================================ */

.nav-item[data-screen="expenses"] svg {
    color: hsl(var(--error)) !important;
}

.nav-item[data-screen="expenses"].active {
    color: hsl(var(--error)) !important;
}

.nav-item[data-screen="expenses"]:hover {
    color: rgba(239, 68, 68, 0.8) !important;
}

/* ============================================================================
   2. EXPENSE CARDS - Bordures Rouges
   ============================================================================ */

.expense-card {
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow);
    transition: var(--transition-smooth);
}

.expense-card:hover {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: var(--glass-shadow-hover);
    transform: translateY(-1px);
}

.expense-card h3 {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-3);
    color: hsl(var(--on-surface));
    font-weight: 600;
}

/* ============================================================================
   3. DATE SELECTOR - Style Expenses
   ============================================================================ */

.expense-card .date-selector-compact {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.expense-card .date-btn-compact {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    color: hsl(var(--on-surface));
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.expense-card .date-btn-compact.active {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border-color: var(--glass-border-hover);
    color: hsl(var(--primary));
    box-shadow: var(--glass-shadow);
    font-weight: 600;
}

.expense-card .date-btn-compact:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
}

.expense-card .calendar-icon-btn-compact {
    width: 36px;
    height: 36px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--primary));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.expense-card .calendar-icon-btn-compact:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
}

.expense-card .date-input-compact {
    width: 100%;
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    border-radius: var(--radius);
    color: hsl(var(--on-surface));
    transition: var(--transition-smooth);
    outline: none;
    font-size: var(--font-size-sm);
}

.expense-card .date-input-compact:focus {
    border-color: rgba(239, 68, 68, 0.4) !important;
    background: var(--glass-bg-hover);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1) !important;
}

/* ============================================================================
   4. FORM INPUTS - Bordures Rouges
   ============================================================================ */

.expense-input {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    border-radius: var(--radius);
    color: hsl(var(--on-surface));
    font-size: var(--font-size-sm);
    transition: var(--transition-smooth);
    outline: none;
}

.expense-input:focus {
    border-color: rgba(239, 68, 68, 0.4) !important;
    background: var(--glass-bg-hover);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1) !important;
}

.expense-input::placeholder {
    color: hsl(var(--on-surface-variant));
    font-size: var(--font-size-xs);
}

.expense-select {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    border-radius: var(--radius);
    color: hsl(var(--on-surface));
    font-size: var(--font-size-sm);
    transition: var(--transition-smooth);
    outline: none;
    cursor: pointer;
}

.expense-select:focus {
    border-color: rgba(239, 68, 68, 0.4) !important;
    background: var(--glass-bg-hover);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1) !important;
}

/* ============================================================================
   5. FORM LAYOUT - Identique aux Ventes
   ============================================================================ */

.expense-card .form-group-inline {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.expense-card .form-group-inline label {
    font-size: var(--font-size-sm);
    color: hsl(var(--on-surface));
    font-weight: 500;
    min-width: 60px;
}

/* Currency style standard (pas rouge) */
.expense-card .currency-compact {
    font-size: var(--font-size-xs);
    color: hsl(var(--primary));
    margin-left: var(--space-1);
    font-weight: 500;
}

/* ============================================================================
   6. BOUTON ENREGISTRER - ROUGE avec Gradient
   ============================================================================ */

#save-expense {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: linear-gradient(135deg, #EF4444, #DC2626);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: var(--font-size-base);
    transition: var(--transition-smooth);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
}

#save-expense:hover:not(:disabled) {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    border-color: rgba(239, 68, 68, 0.7);
    transform: var(--hover-lift);
    box-shadow: 0 12px 32px rgba(239, 68, 68, 0.4);
}

#save-expense:active:not(:disabled) {
    transform: var(--click-scale);
}

#save-expense:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Card contenant le bouton */
.expense-card.total-card-compact {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: var(--glass-shadow-hover);
    padding: var(--space-4);
}

/* ============================================================================
   7. LOADING STATE - Bouton Enregistrer
   ============================================================================ */

#save-expense.loading {
    position: relative;
    color: transparent;
}

#save-expense.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid white;
    border-radius: var(--radius-full);
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

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

/* Animation succès */
@keyframes expenseSuccess {
    0% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
    }

    50% {
        transform: scale(0.95);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 12px 32px rgba(34, 197, 94, 0.4);
    }
}

#save-expense.saving {
    animation: expenseSuccess 0.5s ease;
}

/* ============================================================================
   RESPONSIVE MOBILE - EXPENSES SCREEN
   ============================================================================ */

@media (max-width: 768px) {
    .expense-card {
        padding: var(--space-3);
        margin-bottom: var(--space-2);
        width: 100%;
        box-sizing: border-box;
    }

    .expense-input,
    .expense-select {
        padding: var(--space-2);
        font-size: 16px;
        /* Évite zoom iOS */
        min-height: 40px;
        box-sizing: border-box;
    }

    .expense-card .date-btn-compact {
        padding: var(--space-2);
        font-size: var(--font-size-sm);
        min-height: 40px;
    }

    .expense-card .calendar-icon-btn-compact {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .expense-card .date-input-compact {
        padding: var(--space-2);
        font-size: 16px;
        /* Évite zoom iOS */
        min-height: 40px;
    }

    #save-expense {
        padding: var(--space-3);
        font-size: var(--font-size-base);
        min-height: 48px;
    }

    .expense-card .form-group-inline {
        gap: var(--space-2);
        align-items: center;
    }

    .expense-card .form-group-inline label {
        min-width: 60px;
        font-size: var(--font-size-sm);
    }

    /* Assurer le glassmorphism sur mobile */
    .expense-card,
    .expense-input,
    .expense-select {
        -webkit-backdrop-filter: blur(15px);
        backdrop-filter: blur(15px);
    }
}

@media (max-width: 480px) {
    .expense-card .form-group-inline label {
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 360px) {
    .expense-card {
        padding: var(--space-2);
    }

    .expense-input,
    .expense-select,
    .expense-card .date-input-compact {
        padding: var(--space-1) var(--space-2);
        font-size: var(--font-size-sm);
    }

    .expense-card .calendar-icon-btn-compact {
        width: 36px;
        height: 36px;
    }

    .expense-card .form-group-inline label {
        min-width: 50px;
        font-size: var(--font-size-xs);
    }

    #save-expense {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-sm);
        min-height: 44px;
    }
}

/* ============================================================================
   8. FOCUS VISIBLE - Accessibilité
   ============================================================================ */

.expense-input:focus-visible,
.expense-select:focus-visible,
.expense-card .date-input-compact:focus-visible {
    outline: 2px solid rgba(239, 68, 68, 0.5);
    outline-offset: 2px;
}

#save-expense:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ============================================================================
   COMPONENTS.CSS - PARTIE 5/8 OPTIMISÉE ✅
   Stock Screen - Thème Violet (Inventaire)
   ANCIEN: ~550 lignes | NOUVEAU: ~280 lignes (-49%)
   ============================================================================ */

/* ============================================================================
   1. STOCK HEADER - CORRECTION VISIBILITÉ
   ============================================================================ */

.stock-header-optimized {
    /* FOND VIOLET VIF OPAQUE */
    background: linear-gradient(135deg, rgba(168, 115, 46, 0.95)), rgba(180, 124, 59, 0.705) !important;
    backdrop-filter: blur(20px);
    border-bottom: 2px solid rgba(131, 90, 44, 0.808) !important;
    padding: var(--space-4) var(--space-4) var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    box-shadow: 0 4px 12px rgba(141, 95, 26, 0.699);
}

.back-btn-stock {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(163, 120, 54, 0.781) !important;
    border-radius: var(--radius);
    color: rgba(180, 124, 59, 0.705) !important;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.back-btn-stock:hover {
    background: rgba(255, 255, 255, 1) !important;
    border-color: rgba(180, 124, 59, 0.705) !important;
    transform: var(--hover-lift);
}

.stock-title-section h2 {
    color: #FFFFFF !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin: 0 0 var(--space-1) 0;
    font-size: var(--font-size-xl);
    font-weight: 600;
}

.stock-summary-optimized {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 500;
}

.stock-alerts {
    color: #FFE082 !important;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
   2. RECHERCHE & FILTRES
   ============================================================================ */

.stock-search-section {
    margin-bottom: var(--space-4);
}

.search-bar-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgb(121, 76, 9);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: rgb(75, 46, 2);
}

.search-input-wrapper {
    position: relative;
    margin-bottom: var(--space-3);
}

.search-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: hsl(var(--stock-primary));
    pointer-events: none;
    width: 20px;
    height: 20px;
}

.search-input-optimized {
    width: 100%;
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-12);
    background: rgb(110, 68, 5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-xl);
    color: hsl(var(--on-surface));
    font-size: var(--font-size-sm);
    transition: var(--transition-smooth);
    outline: none;
}

.search-input-optimized:focus {
    border-color: rgb(129, 80, 7);
    background: rgba(136, 85, 9, 0.884);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.filter-controls {
    display: flex;
    gap: var(--space-3);
}

.filter-select {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: rgba(122, 86, 6, 0.911);
    backdrop-filter: blur(10px);
    border: 1px solid rgb(128, 79, 5);
    border-radius: var(--radius);
    color: hsl(var(--on-surface));
    font-size: var(--font-size-sm);
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-select:focus {
    border-color: rgba(104, 73, 5, 0.719);
    background: rgba(141, 78, 6, 0.877);
}

/* ============================================================================
   3. LISTE DES ARTICLES
   ============================================================================ */

.stock-list-section {
    margin-bottom: var(--space-4);
}

.stock-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
    padding: 0 var(--space-2);
}

.stock-list-header h3 {
    color: hsl(var(--stock-primary));
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin: 0;
}

.list-count {
    font-size: var(--font-size-sm);
    color: hsl(var(--on-surface-variant));
    font-weight: 500;
}

.stock-list-optimized {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--space-3);
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.1);
}

/* ============================================================================
   4. STOCK ITEM - Article Individuel
   ============================================================================ */

.stock-item-optimized {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: rgba(139, 92, 246, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
    transition: var(--transition-smooth);
}

.stock-item-optimized:hover {
    background: rgba(139, 92, 246, 0.05);
    border-color: rgba(139, 92, 246, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.stock-item-optimized:last-child {
    margin-bottom: 0;
}

.stock-item-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}

.stock-item-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.1);
    border-radius: var(--radius);
    border: 1px solid rgba(139, 92, 246, 0.2);
    flex-shrink: 0;
}

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

.stock-item-name {
    font-weight: 600;
    color: hsl(var(--on-surface));
    margin-bottom: var(--space-1);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-item-quantity {
    font-size: var(--font-size-xs);
    color: hsl(var(--on-surface-variant));
    font-weight: 500;
}

.stock-item-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ============================================================================
   5. STATUT & CONTRÔLES QUANTITÉ
   ============================================================================ */

.stock-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.stock-status-indicator.ok {
    background: hsl(var(--stock-success));
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.stock-status-indicator.low {
    background: hsl(var(--stock-warning));
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.4);
}

.stock-status-indicator.empty {
    background: hsl(var(--stock-danger));
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.stock-controls-optimized {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: var(--radius);
    padding: var(--space-1);
}

.stock-control-btn {
    width: 28px;
    height: 28px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-sm);
    color: hsl(var(--stock-primary));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: var(--font-size-sm);
    transition: var(--transition-smooth);
}

.stock-control-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    transform: var(--hover-scale);
}

.stock-quantity-display-optimized {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: hsl(var(--stock-primary));
    font-size: var(--font-size-sm);
    padding: 0 var(--space-2);
}

/* ============================================================================
   6. BOUTONS ACTIONS (Delete, Ajuster, Archiver)
   ============================================================================ */

.stock-delete-icon,
.stock-adjust-icon,
.stock-archive-btn {
    background: transparent;
    border: none;
    padding: var(--space-1);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: var(--radius);
    color: hsl(var(--on-surface-variant));
    opacity: 0.6;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stock-delete-icon:hover {
    opacity: 1;
    color: hsl(var(--stock-danger));
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

.stock-adjust-icon:hover {
    opacity: 1;
    color: hsl(var(--stock-primary));
    background: rgba(139, 92, 246, 0.1);
    transform: scale(1.1);
}

.stock-archive-btn:hover {
    opacity: 1;
    background: rgba(139, 92, 246, 0.05);
    transform: scale(1.1);
}

/* ============================================================================
   7. ARTICLES ARCHIVÉS
   ============================================================================ */

.archived-item {
    opacity: 0.5;
    background: linear-gradient(135deg, rgba(100, 100, 100, 0.05), rgba(80, 80, 80, 0.02)) !important;
}

.archived-item .stock-item-name {
    text-decoration: line-through;
    color: hsl(var(--on-surface-variant));
}

.badge-archived {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    margin-left: var(--space-2);
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius);
    font-size: 0.625rem;
    font-weight: 600;
    color: hsl(var(--stock-primary));
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================================
   8. ÉTAT VIDE
   ============================================================================ */

.stock-empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: hsl(var(--on-surface-variant));
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
    color: hsl(var(--stock-primary));
}

.stock-empty-state h4 {
    color: hsl(var(--on-surface));
    margin-bottom: var(--space-2);
    font-size: var(--font-size-lg);
}

/* ============================================================================
   9. HISTORIQUE MOUVEMENTS
   ============================================================================ */

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3);
    background: rgba(46, 21, 6, 0.02);
    border-radius: var(--radius);
    margin-bottom: var(--space-2);
    border-left: 3px;
    transition: var(--transition-smooth);
}

.history-item:hover {
    background: rgba(58, 29, 5, 0.05);
}

.history-item.history-add {
    border-left-color: hsl(var(--stock-success));
}

.history-item.history-archived {
    border-left-color: hsl(var(--on-surface-variant));
    opacity: 0.7;
}

.history-item.history-unarchived {
    border-left-color: hsl(var(--stock-primary));
}

.history-delete-btn {
    background: transparent;
    border: none;
    color: hsl(var(--stock-danger));
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: var(--transition-smooth);
    opacity: 0;
}

.history-item:hover .history-delete-btn {
    opacity: 0.6;
}

.history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    opacity: 1 !important;
    transform: scale(1.1);
}

/* ============================================================================
   10. BOUTONS ACTIONS STOCK (Ajouter Article, Inventaire, Historique)
   ============================================================================ */

.stock-actions {
    margin-bottom: var(--space-4);
}

.stock-action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.1);
}

/* ============================================================================
   BOUTONS STOCK - CORRECTION VISIBILITÉ
   ============================================================================ */

.btn-stock-secondary,
.btn-stock-outline {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-3);

    /* FOND BLANC OPAQUE avec bordure ORANGE VIVE */
    background: #FFFFFF !important;
    border: 2px solid #FF5733 !important;

    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-smooth);
    font-weight: 600;
    font-size: var(--font-size-sm);

    /* TEXTE ORANGE VIF */
    color: #FF5733 !important;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-height: 80px;
    text-align: center;
}

.btn-stock-secondary:hover,
.btn-stock-outline:hover {
    /* FOND ORANGE VIF au hover */
    background: #FF5733 !important;
    border-color: #E63900 !important;

    /* TEXTE BLANC au hover */
    color: #FFFFFF !important;

    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 87, 51, 0.3);
}

.btn-stock-secondary svg,
.btn-stock-outline svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
    margin-bottom: var(--space-1);
}

/* ============================================================================
   RESPONSIVE MOBILE - STOCK SCREEN
   ============================================================================ */

@media (max-width: 768px) {
    .stock-header-optimized {
        padding: var(--space-3);
        gap: var(--space-2);
    }

    .back-btn-stock {
        width: 36px;
        height: 36px;
    }

    .stock-title-section h2 {
        font-size: var(--font-size-lg);
    }

    .stock-summary-optimized {
        font-size: var(--font-size-xs);
        flex-wrap: wrap;
    }

    .search-bar-container {
        padding: var(--space-3);
    }

    .search-input-optimized,
    .filter-select {
        font-size: 16px;
        /* Évite zoom iOS */
    }

    .filter-controls {
        flex-direction: column;
        gap: var(--space-2);
    }

    .stock-list-optimized {
        max-height: 350px;
    }

    .stock-item-optimized {
        padding: var(--space-2) var(--space-3);
    }

    .stock-item-icon {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }

    .stock-controls-optimized {
        gap: 0;
    }

    .stock-control-btn {
        width: 24px;
        height: 24px;
    }

    .stock-delete-icon,
    .stock-adjust-icon,
    .stock-archive-btn {
        width: 28px;
        height: 28px;
        opacity: 0.8;
    }

    .badge-archived {
        font-size: 0.5rem;
        padding: 0.1rem 0.3rem;
    }

    .stock-action-buttons {
        grid-template-columns: 1fr;
        gap: var(--space-2);
        padding: var(--space-3);
    }

    .btn-stock-secondary,
    .btn-stock-outline {
        flex-direction: row;
        justify-content: flex-start;
        padding: var(--space-3) var(--space-4);
        gap: var(--space-3);
        min-height: 50px;
    }

    .btn-stock-secondary svg,
    .btn-stock-outline svg {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    .stock-item-optimized {
        padding: var(--space-2);
    }

    .stock-item-left {
        gap: var(--space-2);
    }

    .stock-item-right {
        gap: var(--space-1);
    }
}

@media (max-width: 360px) {
    .stock-item-optimized {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .stock-item-right {
        width: 100%;
        justify-content: space-between;
    }

    .stock-item-icon {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 768px) {
    /* ... règles existantes ... */

    .action-buttons-grid {
        grid-template-columns: 1fr;
        gap: var(--space-2);
        padding: var(--space-3);
    }

    .action-btn {
        flex-direction: row;
        justify-content: center;
        padding: var(--space-3) var(--space-4);
    }
}

/* ============================================================================
   COMPONENTS.CSS - PARTIE 6/8 OPTIMISÉE ✅
   Profile Screen & Modals (Abonnement, Paiements)
   ANCIEN: ~680 lignes | NOUVEAU: ~320 lignes (-53%)
   ============================================================================ */

/* ============================================================================
   1. PROFILE - USER INFO
   ============================================================================ */

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.user-avatar {
    flex-shrink: 0;
}

.user-avatar img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    border: 2px solid hsl(var(--primary));
    transition: var(--transition-smooth);
}

.user-avatar img:hover {
    transform: var(--hover-scale);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

.user-details {
    flex: 1;
}

.user-details h3 {
    margin: 0 0 var(--space-1) 0;
    color: hsl(var(--primary));
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.user-details p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: hsl(var(--on-surface-variant));
}

/* ============================================================================
   2. SUBSCRIPTION SECTION
   ============================================================================ */

.subscription-section {
    border: 2px solid var(--glass-border-hover);
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    position: relative;
}

.subscription-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--primary-light)));
}

.subscription-status {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.status-badge {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid transparent;
}

.status-badge.active {
    background: linear-gradient(135deg, hsl(var(--success)), rgba(0, 255, 0, 0.8));
    color: white;
    border-color: hsl(var(--success));
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.3);
}

.status-badge.inactive {
    background: linear-gradient(135deg, hsl(var(--error)), rgba(255, 0, 0, 0.8));
    color: white;
    border-color: hsl(var(--error));
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
}

.expiry-date {
    font-size: var(--font-size-sm);
    color: hsl(var(--on-surface-variant));
    margin-bottom: var(--space-2);
}

.expiry-date strong {
    color: hsl(var(--primary));
    font-weight: 600;
}

/* ============================================================================
   3. SETTINGS - TOGGLES
   ============================================================================ */

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition-fast);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item:hover {
    background: var(--glass-bg);
    margin: 0 calc(-1 * var(--space-4));
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    border-radius: var(--radius-lg);
}

.setting-label strong {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: hsl(var(--on-surface));
}

.setting-label small {
    font-size: var(--font-size-xs);
    color: hsl(var(--on-surface-variant));
    display: block;
    margin-top: var(--space-1);
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    transition: var(--transition-smooth);
    border-radius: var(--radius-full);
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--glass-bg-hover);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border-hover);
    transition: var(--transition-smooth);
    border-radius: var(--radius-full);
    box-shadow: var(--glass-shadow);
}

input:checked+.slider {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border-color: var(--glass-border-hover);
}

input:checked+.slider:before {
    transform: translateX(24px);
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

/* ============================================================================
   4. MODAL - STRUCTURE
   ============================================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--space-4);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    box-shadow: var(--glass-shadow-hover);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
}

.modal-header h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: hsl(var(--primary));
    margin: 0;
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

/* ============================================================================
   5. STEP INDICATOR
   ============================================================================ */

.step-indicator {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.step {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 2px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: hsl(var(--on-surface-variant));
    transition: var(--transition-smooth);
}

.step.active {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border-color: var(--glass-border-hover);
    color: hsl(var(--primary));
    box-shadow: var(--glass-shadow);
    transform: var(--hover-scale);
}

.step.completed {
    background: linear-gradient(135deg, hsl(var(--success)), rgba(0, 255, 0, 0.8));
    border-color: hsl(var(--success));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.3);
}

/* ============================================================================
   6. DURATION CARDS (Abonnement)
   ============================================================================ */

.duration-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.duration-card {
    padding: var(--space-6);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    box-shadow: var(--glass-shadow);
}

.duration-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
    box-shadow: var(--glass-shadow-hover);
}

.duration-card.selected {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border-color: var(--glass-border-hover);
    box-shadow: var(--glass-shadow-hover);
}

.duration-card .badge {
    position: absolute;
    top: -8px;
    left: var(--space-4);
    padding: var(--space-1) var(--space-3);
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-light)));
    color: white;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

.duration-card h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: hsl(var(--on-surface));
}

.duration-card .price {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: hsl(var(--primary));
    margin-bottom: var(--space-2);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.duration-card .savings {
    font-size: var(--font-size-sm);
    color: hsl(var(--success));
    font-weight: 600;
    margin-bottom: var(--space-2);
}

/* ============================================================================
   7. PAYMENT METHODS
   ============================================================================ */

.payment-methods-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.payment-method-card {
    padding: var(--space-6);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.payment-method-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
}

.payment-method-card.selected {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border-color: var(--glass-border-hover);
}

.payment-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: var(--font-size-lg);
}

.payment-icon.wave {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.3);
}

.payment-icon.orange {
    background: linear-gradient(135deg, #ea580c, #f97316);
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3);
}

/* ============================================================================
   8. STATUS SCREENS (Processing, Success, Error)
   ============================================================================ */

.status-screen {
    text-align: center;
    padding: var(--space-8) 0;
}

.status-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-6) auto;
    font-size: var(--font-size-3xl);
    font-weight: bold;
    backdrop-filter: blur(15px);
    border: 2px solid transparent;
}

.status-icon.processing {
    background: linear-gradient(135deg, var(--glass-bg), var(--glass-bg-hover));
    border-color: var(--glass-border-hover);
    color: hsl(var(--primary));
}

.status-icon.success {
    background: linear-gradient(135deg, hsl(var(--success)), rgba(0, 255, 0, 0.8));
    border-color: hsl(var(--success));
    color: white;
    box-shadow: 0 8px 30px rgba(0, 255, 0, 0.4);
    animation: successPulse 1s ease;
}

.status-icon.error {
    background: linear-gradient(135deg, hsl(var(--error)), rgba(255, 0, 0, 0.8));
    border-color: hsl(var(--error));
    color: white;
    box-shadow: 0 8px 30px rgba(255, 0, 0, 0.4);
}

@keyframes successPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid transparent;
    border-top: 3px solid currentColor;
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

.status-screen h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--space-4);
    color: hsl(var(--on-surface));
}

.status-screen p {
    color: hsl(var(--on-surface-variant));
    margin-bottom: var(--space-6);
}

/* ============================================================================
   9. BUTTONS
   ============================================================================ */

.btn-primary,
.btn-secondary {
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: center;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-light)));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

.btn-primary:hover {
    transform: var(--hover-lift);
    box-shadow: 0 8px 24px rgba(0, 255, 255, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    color: hsl(var(--primary));
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
}

.back-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    color: hsl(var(--primary));
    font-size: var(--font-size-sm);
    cursor: pointer;
    margin-bottom: var(--space-6);
    padding: var(--space-2) var(--space-4);
    transition: var(--transition-smooth);
}

.back-btn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: var(--hover-lift);
}

/* ============================================================================
   RESPONSIVE MOBILE - PROFILE & MODALS
   ============================================================================ */

@media (max-width: 768px) {
    .user-info {
        gap: var(--space-3);
    }

    .user-avatar img {
        width: 56px;
        height: 56px;
    }

    .subscription-section {
        padding: var(--space-4);
    }

    .modal-content {
        max-width: calc(100vw - var(--space-4));
    }

    .modal-header,
    .modal-body {
        padding: var(--space-4);
    }

    .duration-card {
        padding: var(--space-4);
    }

    .payment-method-card {
        padding: var(--space-4);
    }

    .step {
        width: 32px;
        height: 32px;
    }

    .status-icon {
        width: 64px;
        height: 64px;
        font-size: var(--font-size-2xl);
    }
}

@media (max-width: 480px) {
    .user-info {
        flex-direction: column;
        text-align: center;
    }

    .step-indicator {
        gap: var(--space-2);
    }

    .step {
        width: 28px;
        height: 28px;
        font-size: var(--font-size-xs);
    }

    .duration-card .price {
        font-size: var(--font-size-xl);
    }
}

/* ============================================================================
   COMPONENTS.CSS - PARTIE 7/8 OPTIMISÉE ✅
   Toasts, Dialogs & Utility Classes
   ANCIEN: ~420 lignes | NOUVEAU: ~200 lignes (-52%)
   ============================================================================ */

/* ============================================================================
   1. TOAST NOTIFICATIONS
   ============================================================================ */

.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 3000;
    max-width: 320px;
    pointer-events: none;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    box-shadow: var(--glass-shadow-hover);
    animation: slideIn 0.3s ease-out;
    position: relative;
    transition: var(--transition-smooth);
    pointer-events: auto;
}

.toast:hover {
    transform: var(--hover-lift);
}

.toast.success {
    border-color: rgba(0, 255, 0, 0.3);
    background: linear-gradient(135deg, var(--glass-bg), rgba(0, 255, 0, 0.05));
}

.toast.error {
    border-color: rgba(255, 0, 0, 0.3);
    background: linear-gradient(135deg, var(--glass-bg), rgba(255, 0, 0, 0.05));
}

.toast.warning {
    border-color: rgba(255, 165, 0, 0.3);
    background: linear-gradient(135deg, var(--glass-bg), rgba(255, 165, 0, 0.05));
}

.toast.info {
    border-color: rgba(0, 255, 255, 0.3);
    background: linear-gradient(135deg, var(--glass-bg), rgba(0, 255, 255, 0.05));
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-content {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.toast-icon {
    font-size: var(--font-size-xl);
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: hsl(var(--success));
}

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

.toast.warning .toast-icon {
    color: hsl(var(--warning));
}

.toast.info .toast-icon {
    color: hsl(var(--primary));
}

.toast-message {
    flex: 1;
    font-size: var(--font-size-sm);
    color: hsl(var(--on-surface));
    font-weight: 500;
}

.toast-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.toast-close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: hsl(var(--on-surface-variant));
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.toast-close:hover {
    background: var(--glass-bg-hover);
    color: hsl(var(--error));
    transform: var(--hover-scale);
}

/* ============================================================================
   2. LOADING OVERLAY
   ============================================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 255, 255, 0.1);
    border-top: 4px solid hsl(var(--primary));
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: var(--space-4);
    color: hsl(var(--primary));
    font-size: var(--font-size-base);
    font-weight: 500;
}

/* ============================================================================
   3. CONFIRMATION DIALOG
   ============================================================================ */

.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    padding: var(--space-4);
    animation: fadeIn 0.3s ease;
}

.confirm-content {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    width: 100%;
    max-width: 400px;
    padding: var(--space-6);
    box-shadow: var(--glass-shadow-hover);
    animation: slideUp 0.3s ease-out;
}

.confirm-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--space-4) auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-3xl);
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.1), rgba(255, 165, 0, 0.05));
    border: 2px solid rgba(255, 165, 0, 0.3);
}

.confirm-content h3 {
    text-align: center;
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: hsl(var(--on-surface));
}

.confirm-content p {
    text-align: center;
    font-size: var(--font-size-sm);
    color: hsl(var(--on-surface-variant));
    margin-bottom: var(--space-6);
}

.confirm-actions {
    display: flex;
    gap: var(--space-3);
}

.btn-cancel,
.btn-confirm {
    flex: 1;
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: center;
}

.btn-cancel {
    background: var(--glass-bg);
    color: hsl(var(--on-surface));
    border: 1px solid var(--glass-border);
}

.btn-cancel:hover {
    background: var(--glass-bg-hover);
    transform: var(--hover-lift);
}

.btn-confirm {
    background: linear-gradient(135deg, hsl(var(--error)), rgba(255, 0, 0, 0.8));
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
}

.btn-confirm:hover {
    transform: var(--hover-lift);
    box-shadow: 0 8px 24px rgba(255, 0, 0, 0.4);
}

/* ============================================================================
   4. CARD GÉNÉRIQUE
   ============================================================================ */

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--glass-shadow);
    transition: var(--transition-smooth);
}

.card:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--glass-shadow-hover);
}

.card h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: hsl(var(--primary));
    margin-bottom: var(--space-4);
}

/* ============================================================================
   5. UTILITY CLASSES - SPACING
   ============================================================================ */

.m-0 {
    margin: 0 !important;
}

.m-2 {
    margin: var(--space-2) !important;
}

.m-4 {
    margin: var(--space-4) !important;
}

.mt-4 {
    margin-top: var(--space-4) !important;
}

.mb-4 {
    margin-bottom: var(--space-4) !important;
}

.mb-6 {
    margin-bottom: var(--space-6) !important;
}

.p-0 {
    padding: 0 !important;
}

.p-4 {
    padding: var(--space-4) !important;
}

/* ============================================================================
   6. UTILITY CLASSES - DISPLAY
   ============================================================================ */

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.flex {
    display: flex !important;
}

.flex-col {
    flex-direction: column !important;
}

.flex-center {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.flex-between {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.flex-1 {
    flex: 1 !important;
}

/* ============================================================================
   7. UTILITY CLASSES - TEXT
   ============================================================================ */

.text-center {
    text-align: center !important;
}

.text-left {
    text-align: left !important;
}

.text-right {
    text-align: right !important;
}

.font-bold {
    font-weight: 600 !important;
}

.font-normal {
    font-weight: 400 !important;
}

.text-primary {
    color: hsl(var(--primary)) !important;
}

.text-success {
    color: hsl(var(--success)) !important;
}

.text-error {
    color: hsl(var(--error)) !important;
}

.text-warning {
    color: hsl(var(--warning)) !important;
}

.text-muted {
    color: hsl(var(--on-surface-variant)) !important;
}

.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================================
   8. UTILITY CLASSES - BORDERS & RADIUS
   ============================================================================ */

.rounded {
    border-radius: var(--radius) !important;
}

.rounded-lg {
    border-radius: var(--radius-lg) !important;
}

.rounded-xl {
    border-radius: var(--radius-xl) !important;
}

.rounded-full {
    border-radius: var(--radius-full) !important;
}

.border-none {
    border: none !important;
}

/* ============================================================================
   9. UTILITY CLASSES - SIZING
   ============================================================================ */

.w-full {
    width: 100% !important;
}

.h-full {
    height: 100% !important;
}

/* ============================================================================
   10. SKELETON LOADING
   ============================================================================ */

.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

/* ============================================================================
   11. TYPING INDICATOR
   ============================================================================ */

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--space-2);
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: hsl(var(--primary));
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

/* ============================================================================
   RESPONSIVE MOBILE - TOASTS & UTILITIES
   ============================================================================ */

@media (max-width: 768px) {
    .toast-container {
        left: var(--space-2);
        right: var(--space-2);
        max-width: calc(100vw - var(--space-4));
    }

    .toast {
        padding: var(--space-3);
    }

    .confirm-content {
        padding: var(--space-4);
    }

    .confirm-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .toast {
        padding: var(--space-2);
    }

    .toast-icon {
        font-size: var(--font-size-lg);
    }

    .loading-spinner {
        width: 50px;
        height: 50px;
    }
}

/* ============================================================================
   COMPONENTS.CSS - PARTIE 8/8 FINALE ✅
   Responsive Final, Safe Areas, Optimisations & Cleanup
   ANCIEN: ~380 lignes | NOUVEAU: ~150 lignes (-61%)
   ============================================================================ */

/* ============================================================================
   1. SAFE AREAS iOS (Notch & Home Indicator)
   ============================================================================ */

.main-app {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.chat-header,
.stock-header-optimized {
    padding-top: calc(var(--space-4) + env(safe-area-inset-top));
}

.screen {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ============================================================================
   2. SCROLLBAR STYLING (Webkit & Firefox)
   ============================================================================ */

/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-bg);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--glass-bg-hover);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--glass-bg) rgba(255, 255, 255, 0.02);
}

/* ============================================================================
   3. SELECTION STYLING
   ============================================================================ */

::selection {
    background: rgba(0, 255, 255, 0.3);
    color: hsl(var(--on-surface));
}

::-moz-selection {
    background: rgba(0, 255, 255, 0.3);
    color: hsl(var(--on-surface));
}

/* ============================================================================
   4. FOCUS VISIBLE (Accessibilité)
   ============================================================================ */

*:focus-visible {
    outline: 2px solid hsl(var(--primary));
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline-offset: 4px;
}

/* ============================================================================
   5. LANDSCAPE MODE (Hauteur < 500px)
   ============================================================================ */

@media (orientation: landscape) and (max-height: 500px) {
    .bottom-nav {
        height: 50px;
        padding: var(--space-1) var(--space-2);
    }

    .nav-item svg {
        width: 18px;
        height: 18px;
    }

    .nav-item span {
        display: none;
    }

    .screen-header {
        padding: var(--space-2) var(--space-3);
    }

    .screen-header h2 {
        font-size: var(--font-size-base);
    }
}

/* ============================================================================
   6. TOUCH OPTIMIZATIONS (Mobile)
   ============================================================================ */

button,
a,
input,
select,
textarea,
.nav-item,
.btn-icon {
    -webkit-tap-highlight-color: rgba(0, 255, 255, 0.1);
    touch-action: manipulation;
}

/* Prevent 300ms delay */
a,
button {
    touch-action: manipulation;
}

/* ============================================================================
   7. PRINT STYLES
   ============================================================================ */

@media print {

    .bottom-nav,
    .chat-input-container,
    .btn-icon,
    .toast-container,
    .modal,
    .btn-rappels,
    .stock-icon-btn {
        display: none !important;
    }

    .screen {
        position: relative;
        height: auto;
        overflow: visible;
        padding-bottom: 0;
    }

    .compact-card,
    .stock-item-optimized,
    .rappel-card {
        page-break-inside: avoid;
    }

    * {
        background: white !important;
        color: black !important;
    }
}

/* ============================================================================
   8. REDUCED MOTION (Accessibilité)
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .screen {
        transition: none;
    }

    .nav-item.active svg {
        transform: none;
    }

    .total-amount.updated {
        animation: none;
    }
}

/* ============================================================================
   9. HIGH CONTRAST MODE
   ============================================================================ */

@media (prefers-contrast: high) {
    .bottom-nav {
        border-top-width: 2px;
    }

    .nav-item.active {
        border: 2px solid hsl(var(--primary));
    }

    .screen {
        border: 1px solid var(--glass-border);
    }

    .compact-card,
    .expense-card,
    .stock-item-optimized {
        border-width: 2px;
    }
}

/* ============================================================================
   10. PERFORMANCE OPTIMIZATIONS
   ============================================================================ */

/* GPU Acceleration pour animations */
.screen,
.modal-content,
.toast,
.nav-item,
.btn-primary,
.btn-send {
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Reduce paint pour éléments fixes */
.bottom-nav,
.chat-header,
.chat-input-container {
    contain: layout style paint;
}

/* ============================================================================
   11. BACKDROP FILTERS FALLBACK
   ============================================================================ */

@supports not (backdrop-filter: blur(20px)) {

    .glass-bg,
    .compact-card,
    .bottom-nav,
    .modal-content,
    .chat-header,
    .chat-input-container {
        background: rgba(20, 30, 50, 0.95);
    }
}

/* ============================================================================
   12. ANTI-ALIASING
   ============================================================================ */

* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   13. IMAGE OPTIMIZATIONS
   ============================================================================ */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* ============================================================================
   14. SCREEN READERS (Accessibilité)
   ============================================================================ */

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

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ============================================================================
   15. PREVENT TEXT SELECTION ON UI ELEMENTS
   ============================================================================ */

.bottom-nav,
.nav-item,
.btn-icon,
.quantity-btn,
.stock-control-btn,
.btn-add-compact {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

/* Allow text selection in content areas */
.message-content,
.rappel-content,
.chat-input-main textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
}

/* ============================================================================
   16. CURSOR CUSTOMIZATION (Desktop)
   ============================================================================ */

@media (hover: hover) and (pointer: fine) {

    .nav-item:hover,
    .btn-icon:hover,
    .stock-item-optimized:hover,
    .duration-card:hover,
    .payment-method-card:hover {
        cursor: pointer;
    }
}

/* ============================================================================
   17. OFFLINE INDICATOR
   ============================================================================ */

.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, hsl(var(--error)), rgba(255, 0, 0, 0.8));
    color: white;
    padding: var(--space-2);
    text-align: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    z-index: 9998;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.visible {
    transform: translateY(0);
}

/* ============================================================================
   18. NETWORK STATUS DOT
   ============================================================================ */

.network-status {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-xs);
    color: hsl(var(--on-surface-variant));
}

.network-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}

.network-dot.online {
    background: hsl(var(--success));
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

.network-dot.offline {
    background: hsl(var(--error));
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

/* ============================================================================
   19. FINAL CLEANUP - Ensure proper z-index hierarchy
   ============================================================================ */

/* Z-index scale (from main.css variables) */
.screen {
    z-index: 100;
}

#chat-screen {
    z-index: 99;
}

.bottom-nav {
    z-index: 1000;
}

.autocomplete-dropdown {
    z-index: 1000;
}

.modal {
    z-index: 2000;
}

.confirm-dialog {
    z-index: 2500;
}

.toast-container {
    z-index: 3000;
}

.loading-overlay {
    z-index: 9999;
}

/* ============================================================================
   20. FINAL RESPONSIVE FIXES
   ============================================================================ */

@media (max-width: 360px) {

    /* Ensure minimum touch targets */
    button,
    .nav-item,
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }

    /* Reduce padding on very small screens */
    .compact-card,
    .expense-card {
        padding: var(--space-2);
    }

    .screen-content {
        padding: var(--space-2);
    }
}