/* Components — TECH Menuiserie Espace Client */

/* ========== CARDS ========== */

.account-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: var(--text-xl);
    color: var(--primary);
}

.card-header a {
    color: var(--primary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 600;
}

/* ========== STATS GRID ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--bg-alt);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
    font-family: var(--font-mono);
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ========== ORDER CARDS ========== */

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition);
}

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

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-alt);
}

.order-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.order-number {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--primary);
}

.order-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.order-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.order-status.pending { background: var(--border); color: var(--text-muted); }
.order-status.confirmed { background: var(--info-light); color: #1e40af; }
.order-status.production { background: var(--warning-light); color: #92400e; }
.order-status.shipped { background: var(--info-light); color: #1e40af; }
.order-status.delivered { background: var(--success-light); color: #065f46; }
.order-status.installed { background: var(--success-light); color: #065f46; }
.order-status.cancelled { background: var(--error-light); color: #991b1b; }

.order-body {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-products {
    display: flex;
    gap: 12px;
}

.product-mini {
    width: 50px;
    height: 50px;
    background: var(--bg-alt);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-mini svg {
    width: 24px;
    height: 24px;
    stroke: var(--primary);
}

.order-summary {
    text-align: right;
}

.order-total {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--primary);
}

.order-items {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.order-actions {
    padding: 12px 20px;
    background: var(--bg-alt);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ========== BUTTONS ========== */

.btn {
    padding: 12px 28px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(239, 124, 26, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: white;
    color: var(--error);
    border: 2px solid var(--error-light);
}

.btn-danger:hover {
    background: var(--error-light);
}

.btn-sm {
    padding: 8px 16px;
    font-size: var(--text-xs);
}

.order-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-family: var(--font-body);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.order-btn.primary {
    background: var(--primary);
    color: white;
}

.order-btn.primary:hover {
    background: var(--primary-light);
}

.order-btn.secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--border);
}

.order-btn.secondary:hover {
    border-color: var(--primary);
}

/* ========== FORMS ========== */

.profile-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full {
    grid-column: span 2;
}

.form-group label {
    font-size: var(--text-sm);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: var(--font-body);
    color: var(--text);
    transition: border-color var(--transition);
    background: var(--bg);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input.error,
.form-group textarea.error {
    border-color: var(--error);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--error);
}

.form-actions {
    grid-column: span 2;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 12px;
}

/* ========== DOCUMENTS ========== */

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.document-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-alt);
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.document-row:hover {
    box-shadow: var(--shadow-sm);
}

.document-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.document-icon {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--primary);
}

.document-name {
    font-weight: 500;
}

.document-meta {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: var(--text-xs);
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all var(--transition);
}

.download-btn:hover {
    background: var(--primary-light);
    color: white;
}

/* ========== FILTER TABS ========== */

.filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-alt);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 20px;
}

.filter-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.filter-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ========== TOAST NOTIFICATIONS ========== */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 80px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--primary);
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

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

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ========== LOADING SKELETON ========== */

.loading-skeleton {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, var(--border) 25%, var(--bg-alt) 50%, var(--border) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    animation: shimmer 1.5s infinite;
}

.skeleton-line.wide { width: 80%; }
.skeleton-line.medium { width: 60%; }
.skeleton-line.narrow { width: 40%; }

.skeleton-card {
    height: 120px;
    background: linear-gradient(90deg, var(--border) 25%, var(--bg-alt) 50%, var(--border) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-md);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ========== EMPTY STATE ========== */

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    stroke: var(--border-dark);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: var(--text-xl);
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ========== MODAL ========== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 49, 104, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 600;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.removing {
    animation: fadeOut 0.2s ease forwards;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-xl);
}

.modal h3 {
    margin-bottom: 12px;
}

.modal p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .profile-form {
        grid-template-columns: 1fr;
    }

    .form-group.full {
        grid-column: span 1;
    }

    .form-actions {
        grid-column: span 1;
    }

    .order-body {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .order-summary {
        text-align: left;
    }

    .toast-container {
        right: 16px;
        left: 16px;
    }

    .toast {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .order-actions {
        flex-wrap: wrap;
    }

    .account-card {
        padding: 16px;
    }

    /* Touch targets: min 44px */
    .order-btn {
        padding: 12px 16px;
    }

    .download-btn {
        padding: 12px 16px;
    }

    .filter-tab {
        padding: 12px 16px;
    }

    /* Order info stacking */
    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .order-info {
        flex-direction: column;
        gap: 4px;
    }

    /* Prevent number overflow on 320px */
    .order-number,
    .invoice-number,
    .devis-number {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* Filter tabs horizontal scroll */
    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}
