/* ========================================
   STYLES COMPTE UTILISATEUR - FEXALY
   ======================================== */

/* Variables */
:root {
    --primary-color: #e63946;
    --primary-dark: #c1121f;
    --text-dark: #1d3557;
    --text-light: #6c757d;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e9ecef;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
}

/* ========================================
   PAGES AUTHENTIFICATION
   ======================================== */

.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    flex-direction: column;
}

.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo a {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-light);
    text-align: center;
    margin-bottom: 2rem;
}

/* Formulaires */
.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.auth-form label {
    display: block;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.auth-form input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

.auth-form input.error {
    border-color: var(--error-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Boutons */
.auth-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.auth-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.auth-btn .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Messages */
.auth-message {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

.auth-message.error {
    background: #fee2e2;
    color: var(--error-color);
    border: 1px solid #fecaca;
    display: block;
}

.auth-message.success {
    background: #d1fae5;
    color: var(--success-color);
    border: 1px solid #a7f3d0;
    display: block;
}

/* Liens */
.auth-links {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.auth-links p {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.forgot-password {
    display: block;
    text-align: right;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--text-light);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    padding: 0 1rem;
}

/* Password visibility toggle */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
}

.password-toggle:hover {
    color: var(--text-dark);
}

/* ========================================
   DASHBOARD CLIENT
   ======================================== */

.dashboard-page {
    min-height: 100vh;
    background: var(--bg-light);
}

.dashboard-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dashboard-header .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.user-menu-btn:hover {
    background: var(--border-color);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    display: none;
    z-index: 100;
}

.user-dropdown.active {
    display: block;
}

.user-dropdown a,
.user-dropdown button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: left;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: var(--bg-light);
}

.user-dropdown .logout-btn {
    color: var(--error-color);
    border-top: 1px solid var(--border-color);
}

/* Dashboard Content */
.dashboard-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-welcome {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.dashboard-welcome h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.dashboard-welcome p {
    opacity: 0.9;
}

/* Statistiques */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    background: rgba(230, 57, 70, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-card-label {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Section Commandes */
.dashboard-section {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 2rem;
}

.section-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-header h2 {
    font-size: 1.25rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Liste des commandes */
.orders-list {
    padding: 0;
}

.order-card {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.order-card:last-child {
    border-bottom: none;
}

.order-card:hover {
    background: var(--bg-light);
}

.order-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.order-id {
    font-weight: 600;
    color: var(--text-dark);
}

.order-date {
    color: var(--text-light);
    font-size: 0.85rem;
}

.order-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.order-status.en_preparation {
    background: #fef3c7;
    color: #92400e;
}

.order-status.expedie {
    background: #dbeafe;
    color: #1e40af;
}

.order-status.en_livraison {
    background: #ede9fe;
    color: #5b21b6;
}

.order-status.livre {
    background: #d1fae5;
    color: #065f46;
}

.order-status.annule {
    background: #fee2e2;
    color: #991b1b;
}

.order-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.order-product-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-light);
}

.order-details {
    flex: 1;
}

.order-product-name {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.order-quantity {
    color: var(--text-light);
    font-size: 0.85rem;
}

.order-total {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
}

.order-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
}

.order-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.order-btn-primary {
    background: var(--primary-color);
    color: white;
}

.order-btn-primary:hover {
    background: var(--primary-dark);
}

.order-btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.order-btn-secondary:hover {
    background: var(--border-color);
}

/* Tracking Info */
.tracking-info {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.tracking-info-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.tracking-number {
    font-weight: 600;
    color: var(--info-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--text-light);
}

.empty-state h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.empty-state .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.empty-state .btn:hover {
    background: var(--primary-dark);
}

/* ========================================
   MODAL DÉTAIL COMMANDE
   ======================================== */

.order-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.order-modal.active {
    display: flex;
}

.order-modal-content {
    background: var(--bg-white);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.order-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.order-modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.order-modal-body {
    padding: 1.5rem;
}

/* Timeline de suivi */
.order-timeline {
    position: relative;
    padding-left: 2rem;
}

.order-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -2rem;
    width: 18px;
    height: 18px;
    background: var(--border-color);
    border-radius: 50%;
    border: 3px solid var(--bg-white);
}

.timeline-item.active .timeline-dot {
    background: var(--success-color);
}

.timeline-item.current .timeline-dot {
    background: var(--primary-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(230, 57, 70, 0); }
}

.timeline-content h4 {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.timeline-content p {
    font-size: 0.85rem;
    color: var(--text-light);
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .auth-card {
        padding: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header {
        padding: 1rem;
    }
    
    .dashboard-content {
        padding: 1rem;
    }
    
    .dashboard-welcome {
        padding: 1.5rem;
    }
    
    .dashboard-welcome h1 {
        font-size: 1.5rem;
    }
    
    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .order-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .order-total {
        margin-top: 0.5rem;
    }
    
    .order-actions {
        flex-direction: column;
    }
    
    .order-btn {
        width: 100%;
        text-align: center;
    }
}
