:root {
    --bg-base: #f8fafc;
    --bg-panel: rgba(255, 255, 255, 0.85);
    --bg-panel-solid: #ffffff;
    --border-color: #e2e8f0;
    --border-highlight: rgba(245, 176, 0, 0.5);
    
    --primary: #f5b000;
    --primary-glow: rgba(245, 176, 0, 0.2);
    --secondary: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-image: 
        radial-gradient(ellipse at top left, rgba(59, 130, 246, 0.08), transparent 40%),
        radial-gradient(ellipse at bottom right, rgba(245, 176, 0, 0.08), transparent 40%);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Headers and Glass Panels */
.glass-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.2rem 2rem;
    position: sticky;
    top: 0; z-index: 100;
}

.logo-container {
    display: flex; align-items: center; justify-content: space-between;
    max-width: 1200px; margin: 0 auto;
}

.logo-left { display: flex; align-items: center; gap: 1rem; }
.brand-icon { color: var(--primary); width: 36px; height: 36px; filter: drop-shadow(0 0 10px var(--primary-glow)); }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.5px; background: linear-gradient(to right, #0f172a, #334155); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.logo-left p { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px;}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.05);
}

.container { max-width: 900px; margin: 3rem auto; padding: 0 1.5rem; }

/* Tabs */
.tabs-container { display: flex; gap: 0.5rem; background: #f1f5f9; padding: 5px; border-radius: 12px; border: 1px solid var(--border-color);}
.tab-btn {
    background: transparent; border: none;
    color: var(--text-muted); padding: 0.6rem 1.2rem;
    border-radius: 8px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.5rem; transition: 0.3s;
}
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: #ffffff; 
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3); border-color: transparent;
}

.section-header { text-align: center; margin-bottom: 2.5rem; padding-top: 1rem; }
.section-header h2 { font-size: 2.2rem; margin-bottom: 0.5rem; color: var(--text-main); }
.subtitle { color: var(--text-muted); font-size: 1.1rem; }

/* Forms & Inputs */
.form-container {
    background: #f8fafc; border-radius: 16px; padding: 2rem;
    margin-bottom: 2rem; border: 1px solid var(--border-color);
}
.input-group { margin-bottom: 1.5rem; text-align: left;}
.input-group label { display: block; font-weight: 600; margin-bottom: 0.5rem; color: #475569; font-size: 0.95rem;}
.styled-input {
    width: 100%; padding: 0.9rem 1.2rem; 
    background: #ffffff;
    border: 1px solid #cbd5e1; color: var(--text-main);
    border-radius: 12px; font-size: 1rem; transition: 0.3s;
}
.styled-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-glow); }
.styled-input option { background: var(--bg-panel-solid); }

/* Dropzones */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 20px; padding: 4rem 2rem; text-align: center;
    cursor: pointer; transition: 0.3s; position: relative; overflow: hidden;
    background: #fdfdfd;
}
.drop-zone:hover, .drop-zone.drag-active {
    border-color: var(--primary); background: rgba(245, 176, 0, 0.05);
}
.upload-icon { width: 64px; height: 64px; color: var(--primary); margin-bottom: 1rem; }
.drop-zone.small { padding: 2rem; }
.upload-icon-small { width: 36px; height: 36px; color: var(--primary); margin-bottom:0.5rem;}
.drop-zone h3 { font-size: 1.4rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-main); }
.drop-zone p { color: var(--text-muted); }

.preview-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #ffffff; display: flex; justify-content: center; align-items: center;
}
.preview-container img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-img { max-height: 180px; width: auto; display: block; margin: 0 auto; border-radius: 12px; box-shadow: 0 10px 15px rgba(0,0,0,0.1);}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff; border: none; padding: 1rem 2.5rem;
    border-radius: 30px; font-size: 1.1rem; font-weight: 600;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.8rem;
    transition: 0.3s; box-shadow: 0 10px 20px rgba(59, 130, 246, 0.25);
}
.primary-btn:hover { transform: translateY(-3px); box-shadow: 0 15px 25px rgba(59, 130, 246, 0.4); }
.primary-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; box-shadow: none; }
.full-width { width: 100%; }

.icon-btn { background: transparent; border: 1px solid transparent; width: 36px; height: 36px; display:flex; align-items:center; justify-content:center; border-radius: 8px; cursor: pointer; color: var(--text-muted); transition: 0.2s; }
.icon-btn:hover { background: #f1f5f9; color: var(--danger); border-color: #e2e8f0; }
.remove-btn { position: absolute; top: 1rem; right: 1rem; background: rgba(255, 255, 255, 0.9); color: var(--danger); border: 1px solid var(--border-color); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.1); transition: 0.2s;}
.remove-btn:hover { transform: scale(1.1); background: var(--danger); color: white; }

/* Database List */
.catalog-list-section h3 { font-size: 1.4rem; margin-bottom: 1.5rem; display:flex; align-items:center; gap:0.5rem; color: var(--text-main); }
.catalog-list-section h3 span { background: #f1f5f9; color: var(--text-main); padding: 2px 10px; border-radius: 12px; font-size: 0.9rem; font-weight: 700; border: 1px solid var(--border-color);}
.db-grid { display: flex; flex-direction: column; gap: 0.8rem; }
.db-item {
    background: #ffffff; padding: 1.2rem; border: 1px solid var(--border-color);
    border-radius: 16px; display: flex; justify-content: space-between; align-items: center;
    transition: 0.3s;
}
.db-item:hover { border-color: #cbd5e1; transform: translateX(5px); box-shadow: 0 4px 10px rgba(0,0,0,0.03); }

/* Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-content {
    background: #ffffff; width: 95%; max-width: 650px; max-height: 90vh;
    border-radius: 24px; overflow-y: auto; padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.modal-header h3 { font-size: 1.8rem; font-weight: 700; color: var(--text-main); }
.modal-images-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1.2rem; margin-top: 1.5rem; }
.img-wrapper { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid #e2e8f0; background: #f8fafc; aspect-ratio: 1; }
.img-wrapper img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.9; transition: 0.3s;}
.img-wrapper:hover img { opacity: 1; transform: scale(1.05); }
.delete-img-btn { position: absolute; top: 8px; right: 8px; background: rgba(255, 255, 255, 0.9); color: var(--danger); border: none; border-radius: 50%; width: 28px; height: 28px; display:flex; align-items:center; justify-content:center; cursor: pointer; opacity: 0; transition: 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.img-wrapper:hover .delete-img-btn { opacity: 1; }
.delete-img-btn:hover { background: var(--danger); color: white; }
.add-image-section { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--border-color); }

/* Results Section */
.results-section { margin-top: 4rem; margin-bottom: 5rem; }
.category-card {
    padding: 2.5rem; margin-bottom: 3rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.02);
    border-left: 6px solid var(--primary);
    border-radius: 20px;
}
.category-header { display: flex; align-items: center; gap: 1.5rem; }
.category-icon { width: 56px; height: 56px; color: #0f172a; padding: 14px; background: #fef3c7; border-radius: 16px;  }
.category-name { font-size: 2.2rem; font-weight: 700; color: var(--text-main); margin-top: 5px; }
.category-header h3 { color: var(--text-muted); font-size: 1rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

.features-list { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.8rem; }
.feature-tag {
    background: #f1f5f9; color: #334155;
    border: 1px solid #e2e8f0; padding: 0.6rem 1.5rem;
    border-radius: 30px; font-size: 0.95rem; font-weight: 500;
}

.matches-title { font-size: 1.6rem; color: var(--text-main); margin-bottom: 2rem; display: flex; align-items:center; gap:0.5rem; }

.matches-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; }
.match-card {
    background: #ffffff; border: 1px solid var(--border-color);
    border-radius: 20px; padding: 2.5rem; transition: 0.4s; position: relative;
    overflow: hidden; box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.match-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary)); opacity: 0; transition: 0.4s;
}
.match-card:hover { 
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08); border-color: #cbd5e1;
}
.match-card:hover::before { opacity: 1; }

.match-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; }
.match-header h4 { font-size: 1.4rem; color: var(--text-main); font-weight: 700; }

.confidence-badge {
    background: #dcfce7; color: #166534;
    border: 1px solid #bbf7d0;
    padding: 0.5rem 1rem; border-radius: 12px; font-weight: 700; font-size: 0.9rem;
}
.confidence-badge.medium { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.confidence-badge.low { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }

.match-detail { 
    margin-top: 1.5rem; font-size: 1rem; color: #475569; line-height: 1.7;
    background: #f8fafc; padding: 1.2rem; border-radius: 12px;
    border: 1px solid #f1f5f9;
}
.match-detail strong { color: var(--text-main); font-size: 1.05rem; }

/* Scanning Line */
.scanning-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; flex-direction: column; z-index: 10;
}
.scan-line {
    width: 100%; height: 3px; background: var(--primary);
    box-shadow: 0 0 20px 2px var(--primary); position: absolute; top: 0;
    animation: scan 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes scan { 0% { top: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { top: 100%; opacity: 0; } }

.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
