/* ==========================================================
   PEDIDOS.CSS - Estilo moderno para a página de consulta
   ========================================================== */

/* ==========================================================
   VARIÁVEIS E RESET
   ========================================================== */
:root {
    /* Cores principais do tema (herdadas do style.css) */
    --primary-start: #667eea;
    --primary-end: #764ba2;
    --primary-gradient: linear-gradient(135deg, var(--primary-start), var(--primary-end));
    
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-input: #f8f9fa;
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #888888;
    --border-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    
    --radius-md: 12px;
    --radius-lg: 20px;
}

body {
    background: var(--bg-body);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    margin: 0;
    padding: 20px;
}

.app-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

/* ==========================================================
   HEADER PREMIUM
   ========================================================== */
.header-premium {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: 0 4px 20px var(--shadow-color);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.brand-text h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.brand-text span {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
    background: #6f42c1;
}

.btn-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
}

/* ==========================================================
   CARD DE BUSCA
   ========================================================== */
.search-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 4px 20px var(--shadow-color);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.search-box {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.3s ease;
    min-width: 200px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-start);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.search-btn {
    padding: 14px 24px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}

.search-info {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================
   LISTA DE RESULTADOS (ITENS DE PEDIDO)
   ========================================================== */
.order-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.order-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--shadow-hover);
    border-color: var(--primary-start);
}

.order-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.order-id {
    font-weight: 700;
    color: var(--primary-start);
    font-size: 16px;
}

.order-service {
    color: var(--text-secondary);
    font-size: 14px;
}

.order-quantity {
    color: var(--text-secondary);
    font-size: 14px;
}

.order-date {
    color: var(--text-muted);
    font-size: 13px;
    margin-left: auto;
}

.order-link {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-link i {
    color: var(--primary-start);
}

.order-smm-id {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================
   STATUS (Cores e Ícones)
   ========================================================== */
.order-status {
    font-weight: 600;
    font-size: 14px;
    padding: 4px 12px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-processando,
.status-processing {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.status-concluido,
.status-completed {
    background: #d4edda;
    color: #155724;
    border: 1px solid #28a745;
}

.status-aguardando,
.status-pending {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #007bff;
}

.status-cancelado,
.status-cancelled {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
}

.status-erro,
.status-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
}

.status-parcial,
.status-partial {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

/* ==========================================================
   MODAL DE DETALHES
   ========================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 60vh;
}

.order-detail .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.order-detail .detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

.order-warning {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius-md);
    color: #856404;
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f8d7da;
    border: 1px solid #dc3545;
    border-radius: var(--radius-md);
    color: #721c24;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-secondary-modern {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary-modern:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* ==========================================================
   LOADING E ERRO
   ========================================================== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 16px;
}

.loading.error {
    color: #dc3545;
}

/* ==========================================================
   RESPONSIVIDADE
   ========================================================== */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: stretch;
    }
    
    .brand {
        justify-content: center;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .search-btn {
        width: 100%;
        justify-content: center;
    }
    
    .order-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .order-date {
        margin-left: 0;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .detail-value {
        text-align: left;
    }
    
    .modal-box {
        width: 95%;
        margin: 10px;
    }
}

/* ==========================================================
   BRILHO EXTRA NO MODAL
   ========================================================== */
#orderDetailModal .order-detail {
    padding: 0;
}

#orderDetailModal .detail-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

#orderDetailModal .detail-row:last-child {
    border-bottom: none;
}

#orderDetailModal .detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 120px;
}

#orderDetailModal .detail-value {
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
}

@media (max-width: 768px) {
    #orderDetailModal .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    #orderDetailModal .detail-value {
        text-align: left;
    }
}