/* ============================================
   GPS Peças - Sistema de Busca de Produtos
   Estilos Principais
   ============================================ */

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

:root {
    /* Cores Principais */
    --primary-color: #4A90E2;
    --secondary-color: #16A085;
    --tertiary-color: #5D6D7E;
    --success-color: #27AE60;
    --danger-color: #E74C3C;
    --warning-color: #F39C12;
    
    /* Cores de Fundo */
    --bg-light: #F8F9FA;
    --bg-white: #FFFFFF;
    --bg-gray: #E8EAED;
    
    /* Cores de Texto */
    --text-primary: #2C3E50;
    --text-secondary: #7F8C8D;
    --text-light: #95A5A6;
    
    /* Bordas */
    --border-color: #DFE4EA;
    --border-radius: 8px;
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   Cabeçalho
   ============================================ */

.header {
    background: var(--bg-white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   Área de Filtros
   ============================================ */

.filters-container {
    background: var(--bg-white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.filter-icon {
    font-size: 1.2rem;
}

.filter-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    flex: 1;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-active {
    background: #D4EDDA;
    color: #155724;
}

.badge-inactive {
    background: #F8D7DA;
    color: #721C24;
}

.filter-select,
.filter-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--bg-white);
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.filter-select:disabled {
    background: var(--bg-gray);
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   Botões de Ação
   ============================================ */

.actions-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

.btn {
    padding: 14px 32px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: #3A7BC8;
}

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

.btn-secondary:hover {
    background: #138D75;
}

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

.btn-tertiary:hover {
    background: #4D5D6D;
}

/* ============================================
   Área de Resultados
   ============================================ */

.results-container {
    background: var(--primary-color);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.results-header {
    margin-bottom: 20px;
}

.results-header h2 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.results-info {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
}

#totalProdutos {
    font-weight: 700;
    font-size: 1.2rem;
}

/* ============================================
   Estados de Loading e Empty
   ============================================ */

.loading-state,
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p,
.empty-state p {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.empty-hint {
    font-size: 1rem;
    opacity: 0.8;
}

/* ============================================
   Tabela de Resultados
   ============================================ */

.table-wrapper {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table thead {
    background: var(--bg-gray);
}

.results-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.results-table tbody tr:hover {
    background: var(--bg-light);
}

.results-table td {
    padding: 16px;
    vertical-align: middle;
    color: var(--text-primary);
}

.product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border-color);
}

.no-image {
    width: 60px;
    height: 60px;
    background: var(--bg-gray);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.8rem;
    text-align: center;
}

.codigo-gps {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
}

.descricao-produto {
    font-weight: 500;
    line-height: 1.4;
}

.codigo-original {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.aplicacao {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.montadora {
    font-weight: 500;
}

/* ============================================
   Paginação
   ============================================ */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-page {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-page:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-number {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* ============================================
   Rodapé
   ============================================ */

.footer {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.admin-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.admin-link:hover {
    color: var(--secondary-color);
}

/* ============================================
   Modal de Imagem
   ============================================ */

.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
}

.image-modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.image-modal-close:hover {
    background: #C0392B;
    transform: scale(1.1);
}

#modalImage {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    margin: 0 auto;
    border-radius: var(--border-radius);
}

.image-modal-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--border-color);
    text-align: center;
}

.image-modal-info strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.product-image {
    cursor: pointer;
    transition: all 0.3s ease;
}

.product-image:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* ============================================
   Responsividade
   ============================================ */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .filters-row {
        grid-template-columns: 1fr;
    }
    
    .actions-row {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .table-wrapper {
        overflow-x: auto;
    }
    
    .results-table {
        min-width: 800px;
    }
    
    .pagination {
        flex-direction: column;
        text-align: center;
    }
    
    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .filters-container,
    .results-container {
        padding: 20px;
    }
}


/* ==========================================
   MODAL REDESENHADO - INFORMAÇÕES COMPLETAS
   ========================================== */

/* Modal Body - Layout Horizontal */
.modal-body {
    display: flex;
    gap: 30px;
    width: 100%;
}

.modal-image-container {
    flex: 0 0 400px;
}

.modal-image-container img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.modal-info-container {
    flex: 1;
    overflow-y: auto;
    max-height: 600px;
}

.modal-titulo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.modal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.modal-info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.modal-info-item.full-width {
    grid-column: 1 / -1;
}

.modal-info-item strong {
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-info-item span {
    font-size: 1rem;
    color: #1e293b;
    font-weight: 500;
}

.modal-medidas {
    grid-column: 1 / -1;
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.modal-medidas h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 15px;
}

.medidas-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.medida-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.medida-item strong {
    font-size: 0.85rem;
    color: #64748b;
}

.medida-item span {
    font-size: 1.1rem;
    color: #3b82f6;
    font-weight: 600;
}

/* Responsivo */
@media (max-width: 768px) {
    .modal-body {
        flex-direction: column;
    }
    
    .modal-image-container {
        flex: 1;
    }
    
    .modal-info-grid {
        grid-template-columns: 1fr;
    }
    
    .medidas-grid {
        grid-template-columns: 1fr;
    }
}
