:root {
    /* Dark Theme (Default) */
    --bg-base: #0f172a; /* Slate 900 */
    --bg-glass: rgba(30, 41, 59, 0.7); /* Slate 800 */
    --bg-glass-heavy: rgba(15, 23, 42, 0.95);
    --border-glass: rgba(255, 255, 255, 0.1);
    
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #94a3b8; /* Slate 400 */
    
    --accent-primary: #3b82f6; /* Blue 500 */
    --accent-hover: #2563eb; /* Blue 600 */
    --accent-danger: #ef4444; /* Red 500 */
    --accent-success: #22c55e; /* Green 500 */
    --accent-warning: #f59e0b; /* Amber 500 */
    --accent-unknown: #64748b; /* Slate 500 */
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glow-opacity: 0.15;
    --input-bg: rgba(15, 23, 42, 0.6);
    --overlay-bg: rgba(15, 23, 42, 0.8);
    --card-bg: rgba(255, 255, 255, 0.03);
    --table-header-bg: rgba(255, 255, 255, 0.02);
    --table-border: rgba(255, 255, 255, 0.05);
    --nav-hover-bg: rgba(255, 255, 255, 0.05);
    --btn-secondary-bg: rgba(255, 255, 255, 0.1);
    --btn-ghost-hover: rgba(255, 255, 255, 0.05);
    
    --badge-valid-text: #4ade80;
    --badge-attention-text: #fbbf24;
    --badge-stop-text: #f87171;
    --badge-unknown-text: #94a3b8;

    --badge-valid-bg: rgba(34, 197, 94, 0.15);
    --badge-attention-bg: rgba(245, 158, 11, 0.15);
    --badge-stop-bg: rgba(239, 68, 68, 0.15);
    --badge-unknown-bg: rgba(100, 116, 139, 0.15);
}

[data-theme="light"] {
    --bg-base: #f1f5f9; /* Slate 100 */
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-glass-heavy: rgba(255, 255, 255, 0.95);
    --border-glass: rgba(0, 0, 0, 0.05);
    
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #475569; /* Slate 600 */
    
    --shadow-glass: 0 8px 32px 0 rgba(15, 23, 42, 0.08);
    --glow-opacity: 0.05;
    --input-bg: rgba(255, 255, 255, 0.8);
    --overlay-bg: rgba(241, 245, 249, 0.8);
    --card-bg: rgba(0, 0, 0, 0.02);
    --table-header-bg: rgba(0, 0, 0, 0.02);
    --table-border: rgba(0, 0, 0, 0.03);
    --nav-hover-bg: rgba(0, 0, 0, 0.03);
    --btn-secondary-bg: rgba(0, 0, 0, 0.05);
    --btn-ghost-hover: rgba(0, 0, 0, 0.03);

    --badge-valid-text: #166534; /* Green 800 */
    --badge-attention-text: #92400e; /* Amber 800 */
    --badge-stop-text: #991b1b; /* Red 800 */
    --badge-unknown-text: #334155; /* Slate 700 */

    --badge-valid-bg: rgba(34, 197, 94, 0.1);
    --badge-attention-bg: rgba(245, 158, 11, 0.1);
    --badge-stop-bg: rgba(239, 68, 68, 0.1);
    --badge-unknown-bg: rgba(100, 116, 139, 0.1);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, var(--glow-opacity)) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, var(--glow-opacity)) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography Utilities */
.subtitle {
    color: var(--text-secondary);
    font-weight: 400;
}
.text-sm { font-size: 0.875rem; }
.mt-2 { margin-top: 0.5rem; }
.hidden { display: none !important; }

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

.glass-heavy {
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--border-glass);
    box-shadow: var(--shadow-glass);
}

/* Buttons */
button {
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

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

[data-theme="light"] .btn-secondary:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--btn-ghost-hover);
}

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

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.25rem;
    font-size: 1.25rem;
    border-radius: 50%;
    width: 32px;
    height: 32px;
}
.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    gap: 2px;
    background: var(--input-bg);
    padding: 3px;
    border-radius: 999px;
    border: 1px solid var(--border-glass);
    margin-right: 0.5rem;
}

.theme-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem !important;
    opacity: 0.6;
    border-radius: 999px;
    background: transparent !important;
}

.theme-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1) !important;
}

.theme-btn.active, .btn-secondary.active {
    opacity: 1;
    background: var(--accent-primary) !important;
    color: white !important;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

/* Form inputs & dropdowns */
input[type="password"], input[type="text"], textarea, select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent-primary);
}

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

/* Overlay & Login */
.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay-bg);
    backdrop-filter: blur(8px);
    z-index: 1000;
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    text-align: center;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.brand-icon {
    font-size: 3rem;
    line-height: 1;
}

.login-box p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.login-box button {
    width: 100%;
    padding: 0.75rem;
}

.error-text {
    color: var(--accent-danger);
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    border-top: none;
    border-bottom: none;
    border-left: none;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.nav-item:hover {
    color: var(--text-primary);
    background: var(--nav-hover-bg);
}
.nav-item.active {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.15); /* Primary tinted */
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-glass);
}
.sidebar-footer button {
    width: 100%;
    justify-content: flex-start;
}


/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: none;
    border-right: none;
    border-left: none;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.page-title h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.content-wrapper {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
}

.mb-4 { margin-bottom: 1.5rem; }

.filters-bar {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    align-items: center;
    position: relative;
    z-index: 100;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.search-group {
    flex: 1;
    max-width: 400px;
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0 0.75rem;
}
.search-group input {
    background: transparent;
    border: none;
    padding: 0.75rem 0.5rem;
    outline: none;
    flex: 1;
}
.search-group input:focus {
    border: none;
}
.filter-group select {
    width: auto;
    min-width: 150px;
}

/* Table */
.table-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

th {
    background: var(--table-header-bg);
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
    font-weight: 600;
}

td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--table-border);
}

tbody tr:hover {
    background: var(--table-header-bg);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-valid { background: var(--badge-valid-bg); color: var(--badge-valid-text); }
.status-attention { background: var(--badge-attention-bg); color: var(--badge-attention-text); }
.status-stop { background: var(--badge-stop-bg); color: var(--badge-stop-text); }
.status-unknown { background: var(--badge-unknown-bg); color: var(--badge-unknown-text); }

.status-select, .category-select {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
}

.country-input {
    width: 45px;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 0.75rem;
    text-align: center;
    text-transform: uppercase;
}

.country-input:focus, .category-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.country-input.error {
    border-color: var(--accent-danger);
    background: rgba(239, 68, 68, 0.1);
}

.status-select.valid { color: var(--badge-valid-text); }
.status-select.attention { color: var(--badge-attention-text); }
.status-select.stop { color: var(--badge-stop-text); }
.status-select.unknown { color: var(--badge-unknown-text); }


.country-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flag-icon {
    width: 20px;
    height: auto;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Drawer / Panel */
.drawer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
}

.drawer-content {
    position: relative;
    width: 450px;
    max-width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    animation: slideLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideLeft {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Comments */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comment-card {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1rem;
    position: relative;
    transition: all 0.2s;
}

.comment-card.warning {
    background: rgba(251, 191, 36, 0.15); /* Amber/Warning tint */
    border-color: rgba(251, 191, 36, 0.3);
}

.comment-card.warning .comment-header {
    color: #fbbf24;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.comment-text {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    white-space: pre-wrap;
}

.comment-textarea {
    width: 100%;
    margin-bottom: 0.5rem;
    resize: vertical;
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.add-comment-section {
    margin-top: auto;
    border-top: 1px solid var(--border-glass);
    padding-top: 1.5rem;
}
.add-comment-section h4 {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

/* Edit Form */
.edit-form label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.edit-form select, .edit-form input {
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 0.75rem;
    outline: none;
}

.edit-form select:focus, .edit-form input:focus {
    border-color: var(--accent-primary);
}

.w-full { width: 100%; }
.mt-4 { margin-top: 1.5rem; }

/* Multi-select Category Dropdown */
.dropdown-wrapper {
    position: relative;
    user-select: none;
}

.dropdown-trigger {
    min-width: 180px;
    justify-content: space-between;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#selected-categories-text {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 240px;
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    animation: fadeInScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.dropdown-divider {
    height: 1px;
    background: var(--border-glass);
    margin: 0.5rem 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-item:hover {
    background: var(--nav-hover-bg);
}

.checkbox-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid var(--border-glass);
    border-radius: 4px;
    background: var(--input-bg);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.checkbox-item input[type="checkbox"]:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkbox-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.75rem;
}

.label-text {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.dropdown-item-all {
    margin-bottom: 0.25rem;
}

