/**
 * historico.css - Estilos do histórico de pedidos
 * @version 4.0 - COM ITENS DO PEDIDO
 */

/* ============================================================
   BASE
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f8f9fc;
    color: #1a1a2e;
    line-height: 1.5;
    min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */
.page-header {
    background: linear-gradient(135deg, #ea1d2c, #ea1d2ccc);
    color: #fff;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(234,29,44,0.15);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.back-btn {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 50px;
    background: rgba(255,255,255,0.12);
    transition: all 0.2s;
}

.back-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.2);
    text-decoration: none;
}

.page-header h1 {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
}

.store-name {
    opacity: 0.8;
    font-size: 13px;
    font-weight: 500;
}

/* ============================================================
   BODY
   ============================================================ */
.page-body {
    padding: 20px 0 40px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.empty-icon {
    font-size: 64px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.empty-title {
    font-size: 22px;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.empty-text {
    color: #6b7280;
    font-size: 15px;
    margin-bottom: 24px;
}

/* ============================================================
   ORDER CARD
   ============================================================ */
.order-card {
    background: #fff;
    border-radius: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.02);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.06);
}

.order-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    background: #f8f9fc;
    border-bottom: 1px solid #f0f2f5;
}

.order-number {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    color: #1a1a2e;
}

.order-number i {
    color: #ea1d2c;
    font-size: 14px;
}

.order-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
}

.order-date i {
    font-size: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge i {
    font-size: 11px;
}

.status-warning { background: #fef3c7; color: #92400e; }
.status-info { background: #dbeafe; color: #1e40af; }
.status-primary { background: #e0e7ff; color: #3730a3; }
.status-success { background: #dcfce7; color: #166534; }
.status-danger { background: #fee2e2; color: #991b1b; }
.status-secondary { background: #f3f4f6; color: #4b5563; }

.order-body {
    padding: 16px 18px;
}

/* ============================================================
   ORDER INFO GRID
   ============================================================ */
.order-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 14px;
    flex-shrink: 0;
}

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

.info-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #9ca3af;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.info-value {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    word-break: break-word;
}

/* ============================================================
   ORDER ITEMS
   ============================================================ */
.order-items {
    margin: 12px 0 16px;
    border-top: 1px solid #f0f2f5;
    padding-top: 12px;
}

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

.items-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.items-title i {
    color: #ea1d2c;
}

.items-count {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 12px;
    border-radius: 50px;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: 1px solid #f8f9fc;
    gap: 8px;
}

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

.item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

.item-qtd {
    font-weight: 700;
    color: #6b7280;
    font-size: 13px;
    min-width: 30px;
}

.item-name {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a2e;
}

.item-tag {
    font-size: 11px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 1px 10px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.item-tag i {
    font-size: 10px;
}

.item-tag.item-obs {
    background: #fef9e7;
    color: #92400e;
}

.item-addons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
    margin-top: 2px;
}

.addon-tag {
    font-size: 11px;
    color: #4b5563;
    background: #f0fdf4;
    padding: 1px 10px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.addon-tag i {
    color: #16a34a;
    font-size: 10px;
}

.item-subtotal {
    font-weight: 700;
    font-size: 14px;
    color: #1a1a2e;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================================
   ORDER ACTIONS
   ============================================================ */
.order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f2f5;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    min-height: 38px;
}

.btn-action:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-details {
    background: #f3f4f6;
    color: #1a1a2e;
}

.btn-details:hover {
    background: #e5e7eb;
    color: #1a1a2e;
}

.btn-repeat {
    background: #ea1d2c;
    color: #fff;
}

.btn-repeat:hover {
    background: #c71a27;
    color: #fff;
    box-shadow: 0 4px 16px rgba(234,29,44,0.3);
}

.btn-wa {
    background: #25D366;
    color: #fff;
}

.btn-wa:hover {
    background: #1da851;
    color: #fff;
    box-shadow: 0 4px 16px rgba(37,211,102,0.3);
}

/* ============================================================
   PAGINAÇÃO
   ============================================================ */
.pagination-wrapper {
    margin-top: 24px;
    padding: 16px 0;
}

.pagination {
    gap: 4px;
}

.pagination .page-link {
    border-radius: 12px;
    color: #1a1a2e;
    border: 1px solid #e8eaed;
    padding: 8px 16px;
    font-weight: 500;
    background: #fff;
    min-width: 40px;
    text-align: center;
}

.pagination .page-link:hover {
    border-color: #ea1d2c;
    color: #ea1d2c;
    background: #fef2f2;
}

.pagination .page-item.active .page-link {
    background: #ea1d2c;
    border-color: #ea1d2c;
    color: #fff;
}

.pagination .page-item.active .page-link:hover {
    background: #c71a27;
    border-color: #c71a27;
}

.pagination .page-item.disabled .page-link {
    color: #9ca3af;
    border-color: #e8eaed;
    background: #f8f9fc;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-custom .modal-content {
    border-radius: 20px;
    border: none;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-custom .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f2f5;
    background: #fff;
}

.modal-custom .modal-title {
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-custom .modal-title i {
    color: #ea1d2c;
}

.modal-custom .modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-custom .modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #f0f2f5;
    background: #f8f9fc;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-title i {
    color: #ea1d2c;
}

.items-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

.items-table thead th {
    background: #f8f9fc;
    padding: 8px 12px;
    font-weight: 600;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #f0f2f5;
}

.items-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid #f8f9fc;
}

.items-table tbody tr:last-child td {
    border-bottom: none;
}

.item-details {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.item-details i {
    font-size: 10px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: #4b5563;
}

.total-row.total-grande {
    font-size: 18px;
    color: #1a1a2e;
    border-top: 2px solid #ea1d2c;
    padding-top: 12px;
    margin-top: 4px;
}

.total-row.total-grande span:last-child {
    color: #ea1d2c;
}

/* ============================================================
   RESUMO FINANCEIRO (2026-09-01)
   CORREÇÃO: o JS (historico.php, pedidoCardHtml/linhaResumo) monta o
   resumo com estas classes desde 26/08/2026 (conformidade FL — taxa de
   cartão, taxa de serviço, imposto, etc. precisam de linha própria e
   visível), mas nenhuma regra de CSS pra elas foi adicionada junto —
   renderizava sem estilo nenhum, quase imperceptível no meio do card
   (inclusive a linha de Taxa de Cartão, que é obrigatória por lei
   aparecer clara pro cliente). .total-row/.total-row.total-grande (acima)
   ficaram órfãs, sem uso no JS atual.
   ============================================================ */
.order-resumo-financeiro {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.resumo-linha {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
    color: #4b5563;
}

.resumo-linha.resumo-linha-total {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    border-top: 2px solid #ea1d2c;
    padding-top: 12px;
    margin-top: 6px;
}

.resumo-linha.resumo-linha-total .resumo-valor {
    color: #ea1d2c;
}

.resumo-label {
    color: inherit;
}

.resumo-valor {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    padding: 20px 0;
    border-top: 1px solid #e8eaed;
    margin-top: 20px;
}

.copyright {
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */
@media (max-width: 576px) {
    .page-header {
        padding: 12px 0;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 12px 14px;
    }
    
    .order-body {
        padding: 12px 14px;
    }
    
    .order-info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .order-actions {
        flex-direction: column;
    }
    
    .btn-action {
        width: 100%;
        justify-content: center;
    }
    
    .item-row {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }
    
    .item-subtotal {
        text-align: right;
        padding-left: 30px;
    }
    
    .pagination .page-link {
        padding: 6px 12px;
        font-size: 13px;
        min-width: 34px;
    }
}

@media (max-width: 400px) {
    .order-info-grid {
        grid-template-columns: 1fr;
    }
    
    .order-number {
        font-size: 13px;
    }
    
    .info-value {
        font-size: 13px;
    }
}

/* ============================================================
   MODO ESCURO
   ============================================================ */


/* ============================================================
   ALTO CONTRASTE
   ============================================================ */
@media (prefers-contrast: high) {
    .order-card {
        border-color: #000;
    }
    
    .btn-repeat {
        background: #000;
    }
    
    .btn-repeat:hover {
        background: #333;
    }
    
    .status-badge {
        border: 2px solid currentColor;
    }
    
    .pagination .page-item.active .page-link {
        background: #000;
        border-color: #000;
    }
}

