/* Reset & Modern Design System Tokens */
:root {
    --bg-main: #0b0f19;
    --bg-card: #151c2c;
    --bg-card-hover: #1e283d;
    --border-color: #2a364f;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --emerald: #10b981;
    --emerald-hover: #059669;
    --accent-orange: #f97316;
    --accent-purple: #a855f7;
    --accent-blue: #3b82f6;
    --radius: 12px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: rgba(21, 28, 44, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 1.4rem;
}

.logo-tag {
    font-size: 0.75rem;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    margin-left: 6px;
}

/* Layout Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
    flex: 1;

}

/* Cards & Containers */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.input-card h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    gap: 12px;
}

input[type="url"] {
    flex: 1;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 18px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

input[type="url"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    font-size: 0.9rem;
}

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

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

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

.btn-success:hover {
    background: var(--emerald-hover);
}

.btn-secondary {
    background: #1e293b;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #334155;
}

/* Language Selector Segmented Control */
.lang-selector-container {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lang-selector-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lang-segmented-control {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.lang-btn {
    flex: 1;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #0f172a;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    color: var(--text-secondary);
}

.lang-btn .lang-icon {
    font-size: 1.5rem;
}

.lang-btn .lang-info {
    display: flex;
    flex-direction: column;
}

.lang-btn .lang-info strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.lang-btn .lang-info small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.lang-btn:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.05);
}

.lang-btn.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
    box-shadow: 0 0 0 1px var(--primary), 0 4px 12px rgba(99, 102, 241, 0.2);
}

.lang-btn.active .lang-info strong {
    color: #c7d2fe;
}

.lang-btn.active .lang-info small {
    color: #a5b4fc;
}

.presets {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.preset-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-preset {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-preset:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    border-color: var(--primary);
}

/* Toolbar & Filters */
.toolbar-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 24px;
}

.results-stats {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--emerald);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.category-tabs {
    display: flex;
    gap: 6px;
    background: #0f172a;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.export-actions {
    display: flex;
    gap: 10px;
}

/* Side-by-Side Grid */
.side-by-side-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .side-by-side-grid {
        grid-template-columns: 1fr;
    }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 1.1rem;
}

/* Image Viewer & Bounding Box Overlay */
.image-wrapper {
    position: relative;
    width: 100%;
    max-height: 700px;
    overflow: auto;
    background: #000;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.image-wrapper img {
    width: 100%;
    display: block;
}

.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.bbox {
    position: absolute;
    border: 2px solid var(--emerald);
    background: rgba(16, 185, 129, 0.2);
    border-radius: 3px;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.bbox:hover {
    background: rgba(16, 185, 129, 0.45);
    border-color: #34d399;
    z-index: 10;
}

/* Extracted Numbers List */
.numbers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 650px;
    overflow-y: auto;
    padding-right: 6px;
}

.number-card {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.number-card:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.number-main {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.category-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

.cat-Real-Estate { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.cat-Jobs { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.cat-Vehicles { background: rgba(249, 115, 22, 0.2); color: #fb923c; }
.cat-Services { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.cat-Matrimonial { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.cat-General { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

.raw-snippet {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Badges */
.badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--emerald); }
.badge-info { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.badge-neutral { background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }

/* Spinners & Utilities */
.hidden { display: none !important; }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

.status-banner {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--primary);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    text-align: center;
    font-weight: 500;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Passcode Gate Screen */
.passcode-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.passcode-card {
    max-width: 420px;
    width: 100%;
    text-align: center;
    padding: 36px 32px;
    margin-bottom: 0;
}

.passcode-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.passcode-card h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.passcode-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}

.passcode-input {
    background: #0f172a;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 18px;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 8px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: var(--transition);
}

.passcode-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.passcode-error {
    color: #f87171;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--emerald);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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