/* Page-specific styles — TECH Menuiserie Espace Client */

/* ========== ORDER DETAIL: TIMELINE ========== */

.order-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 24px 0;
}

.timeline-step {
    display: flex;
    gap: 16px;
    position: relative;
    padding-bottom: 24px;
}

.timeline-step:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
    transition: all var(--transition);
}

.timeline-step.completed .timeline-dot {
    background: var(--success);
    color: white;
}

.timeline-step.active .timeline-dot {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 0 4px rgba(239, 124, 26, 0.2);
}

.timeline-step.pending .timeline-dot {
    background: var(--border);
    color: var(--text-muted);
}

.timeline-line {
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-step.completed .timeline-line {
    background: var(--success);
}

.timeline-content {
    flex: 1;
    padding-top: 4px;
}

.timeline-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.timeline-step.pending .timeline-title {
    color: var(--text-muted);
}

.timeline-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

/* ========== ORDER DETAIL: MESSAGES ========== */

.message-thread {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding: 16px 0;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.message.client {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
    flex-shrink: 0;
}

.message.company .message-avatar {
    background: var(--primary);
    color: white;
}

.message.client .message-avatar {
    background: var(--accent);
    color: white;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.message.company .message-bubble {
    background: var(--bg-alt);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.message.client .message-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.message.client .message-time {
    text-align: right;
}

.message-input {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.message-input input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-family: var(--font-body);
}

.message-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.message-input button {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: background var(--transition);
}

.message-input button:hover {
    background: var(--primary-light);
}

/* ========== ORDER DETAIL: PRODUCTS LIST ========== */

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

.product-detail-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-alt);
    border-radius: var(--radius-md);
}

.product-detail-icon {
    width: 56px;
    height: 56px;
    background: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.product-detail-info {
    flex: 1;
}

.product-detail-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.product-detail-specs {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.product-detail-price {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

/* ========== INVOICES TABLE ========== */

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

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

.invoice-number {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--primary);
    min-width: 140px;
}

.invoice-date {
    font-size: var(--text-sm);
    color: var(--text-muted);
    min-width: 120px;
}

.invoice-amount {
    font-family: var(--font-mono);
    font-weight: 600;
    min-width: 100px;
    text-align: right;
}

.invoice-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

.invoice-status.paid { background: var(--success-light); color: #065f46; }
.invoice-status.pending { background: var(--warning-light); color: #92400e; }
.invoice-status.overdue { background: var(--error-light); color: #991b1b; }

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

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

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

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

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

.devis-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.devis-status.en-attente { background: var(--warning-light); color: #92400e; }
.devis-status.accepte { background: var(--success-light); color: #065f46; }
.devis-status.refuse { background: var(--error-light); color: #991b1b; }
.devis-status.expire { background: var(--border); color: var(--text-muted); }

.devis-body {
    padding: 16px 20px;
}

.devis-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.devis-products {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.devis-total {
    text-align: right;
}

.devis-total-ht {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

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

.devis-expiry {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: 16px;
}

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

/* ========== SUPPORT: TICKETS ========== */

.ticket-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.ticket-info {
    flex: 1;
}

.ticket-subject {
    font-weight: 600;
    margin-bottom: 4px;
}

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

.ticket-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.ticket-status.open { background: var(--info-light); color: #1e40af; }
.ticket-status.in-progress { background: var(--warning-light); color: #92400e; }
.ticket-status.resolved { background: var(--success-light); color: #065f46; }
.ticket-status.closed { background: var(--border); color: var(--text-muted); }

.new-ticket-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: 16px;
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font-body);
}

.back-link:hover {
    color: var(--accent);
}

/* ========== RESPONSIVE (page-specific) ========== */

@media (max-width: 900px) {
    .invoice-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .invoice-number,
    .invoice-date,
    .invoice-amount {
        min-width: auto;
    }

    .message {
        max-width: 90%;
    }

    .devis-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .devis-total {
        text-align: left;
    }

    .product-detail-row {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .product-detail-price {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    /* Timeline compact */
    .timeline-dot {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .timeline-line {
        left: 13px;
    }

    .timeline-step {
        gap: 12px;
        padding-bottom: 20px;
    }

    /* Invoice rows full stack */
    .invoice-info {
        flex-direction: column;
        gap: 4px;
    }

    .invoice-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .invoice-status {
        align-self: flex-start;
    }

    /* Devis header stack */
    .devis-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Message bubbles wider */
    .message {
        max-width: 95%;
    }
}
