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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --secondary-hover: #475569;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-light: #64748b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Force browser native controls (like datalist) to render in light mode */
    color-scheme: light;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 50;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.nav-group {
    margin-bottom: 2rem;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    white-space: nowrap;
    /* Prevent wrapping in nav items */
}

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

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.nav-item .icon {
    font-size: 1.25rem;
}

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

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--danger);
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    height: 100vh;
    max-width: 100%;
    /* Increased max-width for wider dashboard */
    margin: 0 auto;
    /* Center content if screen is huge */
    width: 100%;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    /* Further reduced from 1.5rem */
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.25rem;
    /* Reduced from 0.5rem */
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    /* Reduced from 1.5rem */
    padding: 0.75rem;
    /* Reduced from 1rem */
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.actions-group {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

@media (max-width: 1024px) {
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-group {
        margin-left: 0;
        justify-content: flex-end;
    }

    .input,
    .select {
        width: 100% !important;
    }
}

/* Responsive Sidebar */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
    }

    .sidebar-nav,
    .sidebar-footer {
        display: none;
        /* Hidden by default on mobile, toggleable would be better but keeping simple */
    }

    /* Simplified mobile nav */
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .nav-group {
        margin-bottom: 0;
        display: flex;
        gap: 0.5rem;
    }

    .nav-label {
        display: none;
    }

    .nav-item {
        white-space: nowrap;
        width: auto;
        padding: 0.5rem 1rem;
    }

    .main-content {
        padding: 1rem;
    }
}

/* Utility classes update */
.btn-primary-light {
    background: #eff6ff;
    color: var(--primary);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:active {
    transform: translateY(1px);
}

.input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    background: #ffffff;
    color: #000000;
    color-scheme: light;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-weight: 500;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input:hover:not(:focus) {
    border-color: var(--secondary);
}

/* Fix for datalist options visibility - ensure consistent contrast */
/* Datalist itself */
datalist {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Datalist options - need specificity to override browser defaults */
input[list] + datalist option,
datalist option {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Browser-specific fixes for datalist dropdown rendering */
/* Chrome/Edge datalist styling */
input[list]::-webkit-calendar-picker-indicator {
    filter: invert(0);
}

/* Firefox datalist option styling */
@-moz-document url-prefix() {
    option {
        background-color: #ffffff !important;
        color: #000000 !important;
    }
}

/* Ensure the input itself maintains contrast */
input[list] {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Override any potential color-scheme conflicts for datalist inputs */
input[list]:focus {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Additional fallback for all select options to ensure readability */
select option {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Fix for autofill background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #ffffff inset !important;
    -webkit-text-fill-color: #000000 !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    transition: background-color 5000s ease-in-out 0s;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

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

.btn-secondary:hover {
    background: var(--secondary-hover);
    box-shadow: 0 4px 6px -1px rgba(100, 116, 139, 0.3);
}

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

.btn-danger:hover {
    background: var(--danger-hover);
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3);
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
}

.channels-list {
    display: grid;
    gap: 1rem;
}

.channel-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.channel-card:hover {
    box-shadow: var(--shadow-lg);
}

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

.channel-title {
    flex: 1;
}

.channel-title h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.channel-id {
    color: var(--text-light);
    font-size: 0.875rem;
}

.channel-actions {
    display: flex;
    gap: 0.5rem;
}

.channel-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.channel-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-item {
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 0.5rem;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 0.875rem;
    color: var(--text);
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: var(--success);
}

.badge-secondary {
    background: var(--bg);
    color: var(--text-light);
}

/* Admin Permissions */
.admin-permissions {
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.admin-permission-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px dotted var(--border);
}

.admin-permission-row:last-child {
    border-bottom: none;
}

.admin-id {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--text);
}

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

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .2s;
    border-radius: 24px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: .2s;
    border-radius: 50%;
    box-shadow: var(--shadow);
}

.switch input:checked+.switch-slider {
    background-color: var(--primary);
}

.switch input:checked+.switch-slider:before {
    transform: translateX(24px);
}

.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
}

.loading::before {
    content: "⏳";
    display: block;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Raw Questions Table */
.table-container {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    overflow-x: auto;
}

/* Custom scrollbar for table */
.table-container::-webkit-scrollbar {
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 0 0 0.875rem 0.875rem;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    min-width: 1200px;
}

.table thead th,
.data-table thead th {
    text-align: left;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--border);
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(to bottom, var(--bg), var(--card-bg));
    color: var(--text);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table thead th:first-child {
    padding-left: 1.5rem;
}

.table thead th:last-child {
    padding-right: 1.5rem;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px dotted var(--border);
}

.data-table tbody tr:hover {
    background: var(--bg);
    transform: scale(1.001);
    box-shadow: inset 0 0 0 1px var(--primary);
    border-bottom-color: var(--primary);
    z-index: 1;
    /* Ensure shadow is visible */
    position: relative;
}

.quiz-row {
    cursor: pointer;
}

.quiz-row:hover td {
    background-color: #f0f9ff;
    /* Light primary hover */
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.5);
}

.table tbody tr:nth-child(even):hover {
    background: var(--bg);
}

.table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    font-size: 0.9375rem;
    color: var(--text);
    line-height: 1.5;
}

.table tbody td:first-child {
    padding-left: 1.5rem;
    font-weight: 600;
    color: var(--primary);
}

.table tbody td:last-child {
    padding-right: 1.5rem;
}

.cell-actions {
    white-space: nowrap;
    display: flex;
    gap: 0.375rem;
    align-items: center;
}

.cell-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

/* Actions column for transformed questions */
.actions-header {
    min-width: 180px !important;
    width: 180px !important;
    white-space: nowrap !important;
}

.actions-cell {
    white-space: nowrap !important;
    padding: 0.5rem !important;
    min-width: 180px !important;
    width: 180px !important;
}

.btn-action {
    padding: 0.5rem 0.75rem !important;
    font-size: 1.125rem !important;
    min-width: 40px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 0.125rem !important;
    border-radius: 0.5rem !important;
    flex-shrink: 0;
}

/* Table checkboxes for bulk selection */
.table input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
    accent-color: var(--primary);
    transition: transform 0.15s ease;
}

.table input[type="checkbox"]:hover {
    transform: scale(1.15);
}

.table tbody td input[type="checkbox"] {
    vertical-align: middle;
}

/* ID Column with Checkbox and Number */
.id-header {
    text-align: center !important;
}

.id-header input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    margin: 0 auto 0.375rem auto;
    display: block;
}

.id-header div {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.id-cell {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 0.75rem !important;
}

.id-cell input[type="checkbox"] {
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
    margin: 0 auto 0.5rem auto;
    display: block;
    accent-color: var(--primary);
}

.id-number {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-light);
    font-family: 'Courier New', monospace;
    background: var(--bg);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    display: inline-block;
    min-width: 45px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 0;
    margin-top: 2rem;
    background: linear-gradient(to bottom, transparent, var(--card-bg));
    border-radius: 1rem;
    /* Prevent layout shift by maintaining consistent height */
    min-height: 80px;
    flex-wrap: wrap;
}

.pagination .btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    min-width: 140px;
    border-radius: 0.75rem;
    border: 2px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination .btn-nav {
    padding: 0.875rem 1.5rem;
    min-width: 120px;
}

.pagination .btn-jump {
    padding: 0.875rem 1rem;
    min-width: 70px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--card-bg), var(--bg));
    border-style: dashed;
}

.pagination .btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.pagination .btn-jump:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    border-style: solid;
}

.pagination .btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pagination .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg);
    border-color: var(--border);
}

.pager {
    color: var(--text);
    font-weight: 700;
    font-size: 1.125rem;
    padding: 1rem 2rem;
    background: var(--bg);
    border-radius: 0.75rem;
    border: 2px solid var(--border);
    min-width: 150px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stats {
    margin: 0.75rem 0 1.25rem;
}

.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.875rem;
}

.stat-item {
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg) 100%);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.875rem 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.stat-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.15);
}

.stat-item .label {
    color: var(--text-light);
    margin-right: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-item .value {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
}

.stat-item.clickable {
    cursor: pointer;
}

.stat-item.clickable:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--card-bg) 100%);
    border-color: var(--primary);
}

.stat-item.clickable:active {
    transform: translateY(0);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-small {
    max-width: 480px;
}

/* Wider modal variant for bulk patch operations */
.modal-large {
    max-width: 50vw;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.75rem 2rem;
    border-bottom: 2px solid var(--border);
    background: linear-gradient(to bottom, var(--bg), var(--card-bg));
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-light);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.1);
}

form {
    padding: 2rem;
}

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

.form-section h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
    letter-spacing: -0.02em;
}

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

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

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background: var(--card-bg);
}

/* Make multi-line inputs like Patch Content noticeably larger */
.form-group textarea {
    width: 100%;
    min-height: 10vh;
    /* Reduced from 40vh */
    max-height: 20vh;
    /* Added max-height */
    padding: 0.75rem 0.875rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    background: var(--card-bg);
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:hover:not(:focus),
.form-group select:hover:not(:focus) {
    border-color: var(--secondary);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-light);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.modal-content>p {
    padding: 1.5rem 2rem;
    margin: 0;
    line-height: 1.6;
    color: var(--text);
    font-size: 0.9375rem;
}

.modal-content>p+p {
    padding-top: 0;
}

.modal-content>p strong {
    color: var(--primary);
    font-weight: 600;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.875rem;
    padding: 1.75rem 2rem;
    border-top: 2px solid var(--border);
    margin: 0;
    background: var(--bg);
}

.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1.25rem 1.75rem;
    border-radius: 0.75rem;
    border: 2px solid transparent;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    font-size: 0.9375rem;
    display: none;
    z-index: 2000;
    animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 250px;
    max-width: 400px;
}

.notification.active {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification.success {
    background: var(--success);
    color: white;
    border-color: #059669;
}

.notification.success::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: white;
    color: var(--success);
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.notification.error {
    background: var(--danger);
    color: white;
    border-color: #991b1b;
}

.notification.error::before {
    content: "✕";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: white;
    color: var(--danger);
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeOutRow {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

.row-deleting {
    animation: fadeOutRow 0.3s ease-out forwards;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .actions {
        flex-direction: column;
    }

    .channel-details {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .modal-large {
        max-width: 95%;
    }
}

/* Raw Question Tooltip */
.raw-question-tooltip {
    position: fixed;
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    z-index: 10000;
    animation: tooltipFadeIn 0.2s ease;
    overflow: hidden;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    border-bottom: 2px solid var(--primary);
}

.tooltip-header h4 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
}

.tooltip-close {
    font-size: 1.5rem;
    cursor: pointer;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.tooltip-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tooltip-content {
    padding: 1.25rem;
    max-height: 600px;
    overflow-y: auto;
}

.tooltip-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.tooltip-field {
    margin-bottom: 1rem;
}

.tooltip-field:last-child {
    margin-bottom: 0;
}

.tooltip-field-label {
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

.tooltip-field-value {
    font-size: 0.9375rem;
    color: var(--text);
    padding: 0.625rem 0.875rem;
    background: var(--bg);
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary);
}

.tooltip-field-value.options-list {
    padding: 0.5rem 0;
}

.tooltip-option {
    padding: 0.5rem 0.875rem;
    margin: 0.25rem 0;
    background: var(--bg);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.tooltip-option:before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    margin-right: 0.5rem;
}

.source-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.source-link:hover {
    color: #2563eb;
    text-decoration: none;
}

/* Login Page Styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg) 0%, #e2e8f0 100%);
    padding: 1rem;
}

.login-box {
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
}

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

.login-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-light);
}

.btn-block {
    width: 100%;
    justify-content: center;
    margin-top: 1.5rem;
}

.error-message {
    color: var(--danger);
    text-align: center;
    margin-top: 1rem;
    min-height: 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
}

/* User controls in header */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 2rem;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

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

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}