:root {
    --bg: #0f1117;
    --bg-secondary: #1a1d27;
    --card-bg: #1e2130;
    --border: #2a2d3e;
    --text: #e4e6f0;
    --text-muted: #8b8fa3;
    --accent: #6c5ce7;
    --accent-hover: #7c6ef7;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 10px;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.accent { color: var(--accent); }

.brand-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.nav-links {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
    background: rgba(108, 92, 231, 0.1);
    border-left-color: var(--accent);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.logout-link:hover { color: var(--danger); }

/* Main Content */
.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 1.5rem 2rem;
    min-height: 100vh;
}

.main-full {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

/* Login */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.75rem;
    letter-spacing: 2px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

/* Forms */
.input, .textarea, select.input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.input:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.input-sm { max-width: 160px; }

.textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.slider {
    width: 100%;
    accent-color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

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

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

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

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

.btn-secondary:hover { border-color: var(--accent); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover { color: var(--text); }

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

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h1 { font-size: 1.5rem; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.accent-card { border-color: var(--accent); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.accent-card .stat-value { color: var(--accent); }

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.experience-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.experience-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.card-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    font-weight: 600;
}

.card-score {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
}

.score-high { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.score-mid { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.score-low { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.card-location {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.card-summary {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
}

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

.card-source {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Badges & Status */
.badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-weight: 600;
}

.badge-gem {
    background: rgba(108, 92, 231, 0.2);
    color: var(--accent);
}

.status {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 500;
}

.status-pending { background: rgba(139, 143, 163, 0.15); color: var(--text-muted); }
.status-running { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.status-completed { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-failed { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.status-new { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.status-reviewed { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-contacted { background: rgba(108, 92, 231, 0.15); color: var(--accent); }
.status-qualified { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-rejected { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Tags */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: rgba(108, 92, 231, 0.1);
    color: var(--accent);
    border-radius: 20px;
    border: 1px solid rgba(108, 92, 231, 0.2);
}

.tag-count {
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: rgba(108, 92, 231, 0.05);
}

.job-logs {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1rem;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section h2 { font-size: 1.15rem; }

.link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
}

.link:hover { text-decoration: underline; }

/* Filters */
.filters-bar {
    margin-bottom: 1.5rem;
}

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.results-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Detail Page */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
}

.detail-main h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.detail-location {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.detail-section {
    margin-top: 1.5rem;
}

.detail-section h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.detail-map {
    height: 250px;
    border-radius: var(--radius);
    overflow: hidden;
}

.scores-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.score-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
}

.score-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.5s;
}

.score-auth { background: var(--success); }
.score-tour { background: var(--info); }
.score-social { background: var(--warning); }
.score-prem { background: #e879f9; }

.score-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 80px;
}

.score-value {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 30px;
    text-align: right;
}

/* Sidebar cards */
.sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.sidebar-card h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.contact-list, .detail-list {
    list-style: none;
    font-size: 0.85rem;
}

.contact-list li, .detail-list li {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
    word-break: break-all;
}

.contact-list li:last-child, .detail-list li:last-child {
    border-bottom: none;
}

.contact-list a { color: var(--accent); text-decoration: none; }
.contact-list a:hover { text-decoration: underline; }

.muted { color: var(--text-muted); font-size: 0.85rem; }

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state p { margin-bottom: 1rem; }

/* Flash Messages */
.flash-messages { margin-bottom: 1rem; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

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

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

/* Header actions */
.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-brand h2, .sidebar-brand p, .nav-links span, .sidebar-footer { display: none; }
    .nav-links a { padding: 0.75rem; justify-content: center; }
    .main-content { margin-left: 60px; padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .card-grid { grid-template-columns: 1fr; }
    .filters-form { flex-direction: column; }
    .input-sm { max-width: 100%; }
}

/* Reference Links */
.ref-links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.ref-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    transition: border-color 0.2s, background 0.2s;
}
.ref-link:hover {
    border-color: var(--accent);
    background: var(--card-bg);
}
.ref-link-map { border-left: 3px solid var(--info); }
.ref-link-social { border-left: 3px solid var(--accent); }
.ref-link-website { border-left: 3px solid var(--success); }
.ref-icon { font-size: 1rem; }
.ref-label { white-space: nowrap; }

/* Slider styling */
.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}
.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}
