:root {
    /* Colors */
    --bg-main: #0a0e1a;
    --bg-secondary: #131829;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    /* Gradients & Accents */
    --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    --accent-cyan: #06b6d4;
    --accent-indigo: #f59e0b;
    --accent-purple: #ea580c;
    --primary-light: #fbbf24;
    
    /* Semantic Colors */
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    
    /* Glassmorphism */
    --glass-bg: rgba(19, 24, 41, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Animation */
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 15% 50%, rgba(245, 158, 11, 0.08), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(234, 88, 12, 0.08), transparent 25%);
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
}

/* Utilities */
.hidden { display: none !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-4 { margin-top: 1rem; }

/* Glassmorphism Base */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-icon {
    background: var(--accent-gradient);
    -webkit-text-fill-color: initial;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.nav-tabs {
    display: flex;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--glass-border);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.badge {
    background: var(--accent-gradient);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

/* Container & Views */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.view {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.header-section {
    margin-bottom: 2rem;
}

.header-section h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.header-section p {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    font-size: 1rem;
}

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

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--accent-indigo);
    background: rgba(245, 158, 11, 0.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Glow Effect */
.btn-glow {
    position: relative;
    overflow: hidden;
}
.btn-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
    transform: scale(0);
    transition: transform 0.5s ease-out;
}
.btn-glow:hover::after {
    transform: scale(1);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], textarea, select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition-fast);
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="number"]:focus, input[type="search"]:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.select-wrapper {
    position: relative;
}

select {
    appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
}

select option {
    background: var(--bg-main);
    color: var(--text-primary);
}

.select-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

/* Upload View */
.upload-card {
    padding: 2rem;
    border-radius: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.dropzone {
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.1);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent-indigo);
    background: rgba(245, 158, 11, 0.05);
}

.hidden-input {
    display: none;
}

.icon-pulse {
    font-size: 3rem;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
}

.dropzone.dragover .icon-pulse {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.dropzone-content h3 {
    margin-bottom: 0.5rem;
}

.dropzone-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.thumbnails-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.thumbnail-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-thumb {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-remove-thumb:hover {
    background: var(--danger);
}

#btn-analyze {
    width: 100%;
}

/* Result View */
.result-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

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

.result-images {
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.main-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
}

.main-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.status-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
}

.status-draft {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-reviewed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.gallery-thumbnails {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
}
.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.gallery-thumb {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: var(--transition-fast);
}

.gallery-thumb.active {
    border-color: var(--accent-indigo);
    opacity: 1;
}

.result-form {
    padding: 2rem;
    border-radius: 16px;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}
.action-buttons .btn {
    flex: 1;
}

/* Catalog View */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.selected-count {
    font-size: 0.875rem;
    color: var(--accent-cyan);
    font-weight: 500;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.product-card {
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition-smooth);
    position: relative;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(245, 158, 11, 0.3);
}

.card-img-container {
    height: 200px;
    width: 100%;
    background: rgba(0,0,0,0.2);
    position: relative;
}

.card-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-checkbox {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 10;
    accent-color: var(--accent-indigo);
}

.card-content {
    padding: 1.25rem;
}

.card-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    border-radius: 16px;
}

.empty-icon {
    font-size: 4rem;
    color: var(--glass-border);
    margin-bottom: 1rem;
}

/* Modals & Toasts */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    padding: 2rem;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    animation: scaleIn 0.3s ease;
}

.modal h2 { margin-bottom: 1rem; }
.modal p { color: var(--text-secondary); margin-bottom: 2rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 1rem; }

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--accent-cyan); }

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

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* Auth View */
.auth-view {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
}
.auth-view.hidden { display: none; }
.auth-card {
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    border-radius: var(--radius-lg);
}
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.auth-header p { color: var(--text-secondary); }
.user-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}
.user-controls.hidden { display: none; }
.credits-badge {
    background: rgba(234, 88, 12, 0.2);
    color: var(--primary-light);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(234, 88, 12, 0.3);
}
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; }
.nav-links { display: flex; gap: 1rem; }

/* ═══ AutoPeças AI — componentes específicos ═══ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    flex: 1;
}
.filters .select-wrapper { min-width: 190px; }

.search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
}
.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}
.search-box input { padding-left: 2.6rem; }

.confidence-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}
.confidence-high { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.confidence-medium { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.confidence-low { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

.card-code {
    color: var(--primary-light);
    font-weight: 700;
    letter-spacing: 1px;
}
.card-metrics {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.card-metrics i { color: var(--accent-indigo); margin-right: 0.3rem; }
.toast.warning { border-left: 4px solid var(--warning); }
/* Ajustes da Navbar / Tabs baseados no feedback */
.nav-links {
    display: flex;
    gap: 0.5rem;
    margin-left: 3rem; /* Mais longe do nome principal */
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
}
.nav-tab.active {
    background: rgba(245, 158, 11, 0.2); /* Cor de destaque ambar/laranja igual ao crédito */
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border-radius: 50px;
}


/* 📱 Responsividade Mobile */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    .nav-links {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    .user-controls {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    .result-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .header-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .header-section .btn {
        width: 100%;
    }
    .toolbar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    .admin-card form {
        grid-template-columns: 1fr !important;
        align-items: stretch !important;
    }
    .admin-card form .btn {
        margin-top: 1rem;
    }
    .dropzone-content h3 {
        font-size: 1.2rem;
    }
    .auth-card {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .action-buttons { flex-direction: column; }
    .action-buttons .btn { width: 100%; }
    .flex-between { flex-direction: column; align-items: stretch; gap: 1rem; }
}
