.hidden,
[hidden],
.admin-only-view.hidden,
.kebab-item.hidden {
    display: none !important;
}

:root {
    --bg-body: #f4f7fe;
    --sidebar-bg: #0b1437;
    --sidebar-hover: #1b254b;
    --primary-blue: #1e5eff;
    --table-blue: #113f9f;
    --purple-header: #9b51e0;
    --text-dark: #2b3674;
    --text-gray: #707eae;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;

    /* Dedicated Input & Box Variables */
    --input-bg: #f8fafc;
    --input-text: #2b3674;
    --input-placeholder: #a3aed1;
    --quiz-box-bg: #f1f3f4;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background: var(--bg-body);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ======================================================
   REINFORCED FORM INPUTS & QUIZ BUILDER LAYOUT FIX
   ====================================================== */

/* 1. Standard text inputs & textareas (Excludes Radio & Checkboxes) */
input:not([type="radio"]):not([type="checkbox"]),
select,
textarea {
    box-sizing: border-box !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    font-size: 14px !important;
    font-family: inherit !important;
    background: var(--input-bg, #f8fafc) !important;
    color: var(--input-text, #2b3674) !important;
    transition: background 0.2s, color 0.2s, border-color 0.2s !important;
}

/* Apply full-width block layout to standalone form inputs */
.box>input:not([type="radio"]):not([type="checkbox"]),
.box>select,
.box>textarea,
#loginScreen input {
    display: block !important;
    width: 100% !important;
    margin: 8px 0 !important;
    padding: 12px 16px !important;
}

/* 2. Reset Radio & Checkbox buttons to inline sizes */
input[type="radio"],
input[type="checkbox"] {
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer !important;
    accent-color: var(--primary-blue, #1e5eff) !important;
}

/* 3. Quiz Builder Question Header Flex Fix */
.gform-question-header {
    display: flex !important;
    flex-direction: row !important;
    gap: 15px !important;
    margin-bottom: 16px !important;
    align-items: flex-start !important;
    width: 100% !important;
}

.gform-q-input,
.blk-prompt {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    /* Prevents flex item from collapsing */
    width: 100% !important;
    background: var(--quiz-box-bg, #f1f3f4) !important;
    color: var(--text-dark, #2b3674) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-color, #70757a) !important;
    border-radius: 4px 4px 0 0 !important;
    padding: 16px !important;
    font-size: 15px !important;
    box-sizing: border-box !important;
}

.gform-type-select {
    width: 200px !important;
    flex-shrink: 0 !important;
    /* Prevents select from taking 100% width */
    margin: 0 !important;
    padding: 12px !important;
    background: var(--card-bg, #ffffff) !important;
    color: var(--text-dark, #202124) !important;
    border: 1px solid var(--border-color, #dadce0) !important;
    border-radius: 4px !important;
}

/* 4. Quiz Builder Option Rows Flex Fix */
.gform-opt-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
    width: 100% !important;
}

.gform-opt-input {
    flex: 1 !important;
    width: auto !important;
    margin: 0 !important;
    padding: 8px 0 !important;
    border: none !important;
    border-bottom: 1px solid transparent !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--text-dark, #202124) !important;
    font-size: 14px !important;
}

.gform-opt-input:focus {
    border-bottom: 2px solid var(--purple-header, #673ab7) !important;
    outline: none !important;
}

/* Textarea height adjustment */
textarea {
    min-height: 100px;
    resize: vertical;
}

/* Placeholder text color */
input::placeholder,
textarea::placeholder {
    color: var(--input-placeholder, #a3aed1) !important;
    opacity: 0.85;
}

/* Focus outline and border highlighting */
input:focus,
select:focus,
textarea:focus {
    outline: none !important;
    border-color: var(--primary-blue, #1e5eff) !important;
    background: var(--card-bg, #ffffff) !important;
}

/* Autocomplete wrapper fix */
.autocomplete-container {
    position: relative;
    width: 100% !important;
    display: block !important;
}

/* --- Layout Structure --- */
/* --- Facebook-Style Icon Top Navigation Bar --- */
.app-container {
    display: flex;
    flex-direction: column !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow: hidden !important;
}

.sidebar,
.student-sidebar {
    width: 100vw !important;
    height: 56px !important;
    min-height: 56px !important;
    background: var(--sidebar-bg, #0b1437) !important;
    color: white !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 16px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    z-index: 1000 !important;
}

.sidebar {
    padding: 0 20px !important;
}

.brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-left: 2px !important;
    padding: 0 !important;
    border-bottom: none !important;
    flex-shrink: 0 !important;
}

.brand-badge,
.brand-logo-container,
.brand>div:first-child {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    background-color: #ffffff !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 4px !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

.brand-badge img,
.brand-logo-container img,
.brand>div:first-child img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

.brand h2 {
    font-size: 15px !important;
    font-weight: 800 !important;
    margin: 0 !important;
    letter-spacing: 0.5px !important;
    color: #ffffff !important;
}

.brand p {
    font-size: 11px !important;
    margin: 0 !important;
    color: var(--text-gray, #a0aec0) !important;
}

.menu-bar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    padding: 0 !important;
    height: 100% !important;
    width: auto !important;
    margin: 0 auto !important;
}

/* Icon-only nav button with tooltip hover */
.menu-btn {
    background: transparent !important;
    color: var(--text-gray, #a0aec0) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 52px !important;
    height: 48px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer !important;
    position: relative !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
}

.menu-btn:hover {
    background: var(--sidebar-hover, rgba(255, 255, 255, 0.1)) !important;
    color: #ffffff !important;
    transform: none !important;
}

/* Active Tab Indicator (Facebook Style Bottom Line) */
.menu-btn.active {
    background: transparent !important;
    color: #1e5eff !important;
    box-shadow: none !important;
}

.menu-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 4px;
    right: 4px;
    height: 3px;
    background: #1e5eff;
    border-radius: 3px 3px 0 0;
}

.menu-btn .menu-label {
    display: none !important;
    /* Hidden by default, shown on hover tooltip */
}

/* Tooltip on Cursor Hover */
.menu-btn:hover::before {
    content: attr(data-label);
    position: absolute;
    top: 54px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.menu-icon {
    width: 22px !important;
    height: 22px !important;
    stroke: currentColor !important;
}

.user-profile-bottom {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-top: none !important;
    flex-shrink: 0 !important;
}

.main-wrapper {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    padding: 0 32px 32px !important;
    height: calc(100vh - 56px) !important;
}

.menu-btn:hover .menu-icon {
    transform: scale(1.08);
}

.menu-btn.active .menu-icon {
    transform: scale(1.05);
}

/* Submenu & Expandable Group for Top Navigation Bar */
.menu-item-group {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
}

.submenu-arrow {
    width: 12px !important;
    height: 12px !important;
    flex-shrink: 0 !important;
    margin-left: 4px !important;
    transition: transform 0.2s ease !important;
    stroke: currentColor !important;
}

.menu-item-group:hover .submenu-arrow,
.menu-item-group.open .submenu-arrow {
    transform: rotate(180deg) !important;
}

/* Hover Dropdown Popup for Databases */
.submenu {
    display: none !important;
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: #0b1437 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 12px !important;
    padding: 6px !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35) !important;
    z-index: 10000 !important;
    min-width: 170px !important;
    flex-direction: column !important;
    gap: 4px !important;
}

.menu-item-group:hover .submenu,
.menu-item-group.open .submenu {
    display: flex !important;
    animation: fadeIn 0.15s ease-out !important;
}

.submenu-btn {
    background: transparent !important;
    color: #a0aec0 !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
    user-select: none !important;
    white-space: nowrap !important;
}

.submenu-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    transform: none !important;
}

.submenu-btn.active {
    background: rgba(30, 94, 255, 0.25) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-left: 3px solid var(--primary-blue, #1e5eff) !important;
    border-radius: 4px 10px 10px 4px !important;
}

.submenu-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
}

/* Registration Mode Toggle */
.register-mode-toggle {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
}

.toggle-mode-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-gray, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-mode-btn.active {
    background: #ffffff;
    color: var(--primary-blue, #1e5eff);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

body.dark-theme .register-mode-toggle {
    background: #111c44;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .toggle-mode-btn {
    color: #a0aec0;
}

body.dark-theme .toggle-mode-btn.active {
    background: #1b254b;
    color: #60a5fa;
}

/* Database Table Pagination */
.db-pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    flex-wrap: wrap;
    gap: 12px;
}

.db-pagination-info {
    font-size: 13px;
    color: var(--text-gray, #64748b);
    font-weight: 500;
}

.db-pagination-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.db-page-btn {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    color: var(--text-dark, #2b3674);
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.db-page-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: var(--primary-blue, #1e5eff);
    color: var(--primary-blue, #1e5eff);
}

.db-page-btn.active {
    background: var(--primary-blue, #1e5eff);
    border-color: var(--primary-blue, #1e5eff);
    color: #ffffff;
}

.db-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

body.dark-theme .db-page-btn {
    background: #1b254b;
    border-color: #2b3674;
    color: #f4f7fe;
}

body.dark-theme .db-page-btn:hover:not(:disabled) {
    background: #24305e;
}

body.dark-theme .db-page-btn.active {
    background: var(--primary-blue, #1e5eff);
    border-color: var(--primary-blue, #1e5eff);
    color: #ffffff;
}

.user-profile-bottom {
    margin-top: auto;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Main Content Area --- */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 32px 32px;
}

/* --- Topbar Styling --- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    position: sticky;
    top: 0;
    background: var(--bg-body);
    z-index: 10;
}

.header-title h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

.header-title p {
    margin: 6px 0 0 0;
    color: var(--text-gray, #707eae);
    font-size: 16px;
    font-weight: 500;
}

.welcome-user-highlight {
    font-size: 17.5px;
    font-weight: 800;
    color: var(--primary-blue, #1e5eff);
    letter-spacing: 0.2px;
}

body.dark-theme .welcome-user-highlight,
body.dark-mode .welcome-user-highlight {
    color: #60a5fa !important;
    text-shadow: 0 0 16px rgba(96, 165, 250, 0.4);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logout-btn {
    background: transparent;
    color: #e02d2d;
    border: 1px solid #e02d2d;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.logout-btn:hover {
    background: #ffeaea;
}

/* --- Dashboard Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Updated for 6 items */
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-info p {
    margin: 0;
    font-size: 12px;
    color: #707eae;
    font-weight: 500;
}

.stat-info h3 {
    margin: 4px 0 0;
    font-size: 22px;
    color: var(--text-dark);
}

/* --- Content Layout --- */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
    align-items: start;
    /* Prevents boxes from stretching vertically */
}

.box {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
    height: fit-content;
    /* Hugs the internal content height strictly */
}

.box h3 {
    margin-top: 0;
    font-size: 18px;
    color: var(--text-dark);
    font-weight: 700;
    margin-bottom: 16px;
}

/* --- Form Elements --- */
/* Global Form Elements Dark/Light Synchronization */
input,
select,
textarea {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 12px 16px;
    box-sizing: border-box;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    background: var(--input-bg);
    color: var(--input-text);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: white;
}

button {
    background: var(--primary-blue);
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    padding: 12px;
    border-radius: 10px;
    width: 100%;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto !important;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-height: 220px;
    /* Prevents short tables from cutting off kebab popups */
    padding-bottom: 50px;
    /* Extra spacing at bottom for open menus */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

/* Kebab Dropdown Menu Z-Index & Positioning */
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    z-index: 999;
    /* Keeps popup above all other table rows */
    min-width: 170px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    white-space: nowrap;
}

th,
td {
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    text-align: left;
    font-size: 14px;
}

#studentsTable th,
#adminTable th {
    background-color: var(--table-blue);
    color: white;
    font-weight: 500;
}

#pointsTable th {
    background-color: var(--purple-header);
    color: white;
    font-weight: 500;
}

td {
    color: #475569;
    font-weight: 500;
}

edit-btn,
.delete-btn {
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    margin: 2px;
}

.edit-btn {
    background: transparent;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
}

.delete-btn {
    background: transparent;
    border: 1px solid #e02d2d;
    color: #e02d2d;
}

.edit-btn:hover {
    background: var(--primary-blue);
    color: white;
}

.delete-btn:hover {
    background: #e02d2d;
    color: white;
}

.hidden {
    display: none !important;
}

.full-width-box {
    grid-column: 1 / -1;
}

/* Notice List Styling */
.notice-item {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.notice-date {
    background: #f0f4ff;
    color: var(--primary-blue);
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    height: fit-content;
    font-weight: bold;
}

.notice-content h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
}

.notice-content p {
    margin: 0;
    font-size: 13px;
    color: #707eae;
}

/* Dashboard Overview Grid & Panels */
.dashboard-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
    align-items: stretch;
}

.dashboard-panel {
    margin-bottom: 0 !important;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.quick-actions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid #edf2f7;
    background: var(--card-bg, #ffffff);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.quick-action-item:hover {
    background: #f8fafc;
    border-color: rgba(30, 94, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.quick-action-item .stat-icon {
    border-radius: 12px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.quick-action-item:hover .stat-icon {
    transform: scale(1.06);
}

body.dark-theme .quick-action-item {
    border-color: rgba(255, 255, 255, 0.08);
    background: #18224d;
}

body.dark-theme .quick-action-item:hover {
    background: #1f2c63;
    border-color: rgba(30, 94, 255, 0.5);
}

/* ======================================================
   LOGIN SCREEN CONTAINER FIX
   ====================================================== */

.hidden,
#adminDashboard.hidden,
#loginScreen.hidden {
    display: none !important;
}

#loginScreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: var(--bg-body) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

/* Force hiding when JavaScript adds the .hidden class */
#loginScreen.hidden {
    display: none !important;
}

.login-card {
    width: 100% !important;
    max-width: 400px !important;
    padding: 32px 28px !important;
    border-radius: 20px !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    box-sizing: border-box !important;
}

#loginScreen h2 {
    margin: 0 0 4px 0;
    color: var(--text-dark);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
}

#loginScreen input {
    margin: 0 !important;
    width: 100% !important;
    height: 48px;
    padding: 12px 16px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-sizing: border-box;
}

#loginScreen input::placeholder {
    color: var(--input-placeholder);
    opacity: 0.85;
}

#loginScreen button {
    margin-top: 8px !important;
    height: 48px;
    font-size: 15px;
    font-weight: 600;
    background: var(--primary-blue);
    color: #ffffff;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

#loginScreen button:hover {
    opacity: 0.9;
}

.kebab-menu {
    position: relative;
    display: inline-block;
}

.kebab-btn {
    background: none;
    border: none;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px;
    color: var(--text-gray);
    width: auto;
}

.kebab-btn:hover {
    color: var(--text-dark);
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    overflow: hidden;
    z-index: 100;
    min-width: 170px;
    border: 1px solid var(--border-color);
}

.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-dark);
    border-radius: 0;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #f8fafc;
    color: var(--primary-blue);
    transform: none;
    /* overrides global button hover */
}

.dropdown-item.danger {
    color: #e02d2d;
}

.dropdown-item.danger:hover {
    background: #ffeaea;
}

.eye-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    color: #a3aed1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    border-radius: 4px;
    width: auto;
    margin: 0;
}

.eye-btn:hover {
    background: #eef2ff;
    color: var(--primary-blue);
}

/* --- Autocomplete Dropdowns --- */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-items {
    position: absolute;
    border: 1px solid var(--border-color);
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.autocomplete-items div {
    padding: 12px 16px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: var(--text-dark);
}

.autocomplete-items div:hover {
    background-color: #eef2ff;
    color: var(--primary-blue);
    font-weight: 500;
}

.autocomplete-items div:last-child {
    border-bottom: none;
}

/* --- Redesigned Manage Quiz Layout --- */
.quiz-header-bar {
    background: #1c1c1c;
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.quiz-header-info h2 {
    margin: 0;
    font-size: 18px;
    display: inline-block;
}

.save-status {
    font-size: 12px;
    color: #a3aed1;
    margin-left: 15px;
}

.quiz-header-info p {
    margin: 5px 0 0;
    font-size: 13px;
    color: #a3aed1;
}

.preview-btn {
    background: #dcd6ff;
    color: #5a32a3;
    border-radius: 8px;
    width: auto;
    font-weight: 600;
    padding: 10px 20px;
}

.preview-btn:hover {
    background: #cbbfff;
}

.quiz-tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 24px;
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    color: #707eae;
    border: none;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    width: auto;
    cursor: pointer;
}

.tab-btn.active {
    color: #2b3674;
}

.tab-btn.text-blue {
    color: #1e5eff;
}

.quiz-builder-layout {
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    gap: 24px;
    align-items: start;
}

/* Left Sidebar */
.quiz-sidebar-left h4 {
    margin-top: 0;
    color: #2b3674;
}

.question-category h5 {
    color: #707eae;
    font-size: 12px;
    text-transform: uppercase;
    margin: 20px 0 10px;
}

.q-type-btn {
    background: white;
    border: 1px solid transparent;
    color: #2b3674;
    text-align: left;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.q-type-btn.active,
.q-type-btn:hover {
    border: 1px solid #9b51e0;
    background: #faf7ff;
}

.q-type-btn .icon {
    display: inline-flex;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.mcq-icon {
    background: #9b51e0;
}

.tf-icon {
    background: #8b5cf6;
}

.open-icon {
    background: #334155;
}

.poll-icon {
    background: #475569;
}

.reorder-icon {
    background: #10b981;
}

.match-icon {
    background: #34d399;
}

.drag-icon {
    background: #3b82f6;
}

.sequence-icon {
    background: #60a5fa;
}

/* Middle Editor */
.editor-title-row {
    margin-bottom: 20px;
}

.invisible-input {
    border: none;
    background: transparent;
    font-size: 22px;
    font-weight: bold;
    color: #2b3674;
    padding: 0;
    width: 100%;
    border-bottom: 1px solid transparent;
}

.invisible-input:focus {
    border-bottom: 1px solid #e2e8f0;
    background: white;
}

.quiz-block-new {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.q-settings-row {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #f8fafc;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.q-settings-row select,
.q-settings-row .styled-select {
    margin: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    width: auto;
    flex: 1;
}

.q-number-badge {
    background: #9b51e0;
    color: white;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: bold;
}

.q-actions {
    margin-left: auto;
    display: flex;
    gap: 5px;
}

.icon-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    padding: 0;
    color: #707eae;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #f1f5f9;
    color: #e02d2d;
}

.q-block-body label {
    font-size: 13px;
    font-weight: 600;
    color: #2b3674;
    margin-bottom: 8px;
    display: block;
}

.q-text-input {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    width: 100%;
    margin-bottom: 10px;
    font-family: inherit;
    resize: vertical;
}

.add-media-link,
.add-explanation-link {
    color: #9b51e0;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 20px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 500;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.opt-radio {
    margin: 0;
    width: 20px;
    height: 20px;
    accent-color: #10b981;
}

.opt-input-wrapper {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.opt-label {
    font-size: 11px;
    color: #707eae;
    background: #f8fafc;
    padding: 6px 12px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

.opt-text {
    border: none;
    margin: 0;
    border-radius: 0;
    background: white;
    padding: 10px 12px;
}

.add-choice-btn {
    background: #f8fafc;
    color: #707eae;
    border: 1px dashed #cbd5e1;
    width: 100%;
    font-weight: 600;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
}

.add-choice-btn:hover {
    background: #f1f5f9;
}

.save-quiz-btn {
    background: #9b51e0;
    color: white;
    padding: 15px;
    border-radius: 12px;
    font-size: 15px;
}

/* Right Sidebar */
.right-panel-box {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-bottom: 20px;
}

.right-panel-box h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2b3674;
}

.flex-row {
    display: flex;
    gap: 12px;
}

.field-group {
    flex: 1;
    margin-bottom: 15px;
}

.field-group label {
    display: block;
    font-size: 13px;
    color: #707eae;
    margin-bottom: 6px;
    font-weight: 600;
}

.styled-select,
.styled-textarea {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    background: white;
    margin: 0;
}

.media-upload-box {
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f8fafc;
}

.media-upload-box .upload-icon {
    display: block;
    font-size: 24px;
    margin-bottom: 10px;
    color: #9b51e0;
}

.media-upload-box p {
    font-size: 12px;
    color: #707eae;
    margin: 0;
}

.media-upload-box a {
    color: #9b51e0;
    font-weight: 600;
    text-decoration: none;
}

.resource-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.resource-card h5 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #2b3674;
    line-height: 1.4;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    flex: 1;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 78%;
    background: #9b51e0;
    border-radius: 3px;
}

.progress-text {
    font-size: 12px;
    font-weight: bold;
    color: #9b51e0;
}

/* --- Google Forms Style Quiz Builder --- */
.gform-container {
    background-color: #f0ebf8;
    position: fixed;
    /* Changed from absolute to fixed */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Changed to force bounds */
    z-index: 2000 !important;
    overflow-y: auto;
    /* Re-enables scrolling */
}

/* Reset button overrides for Quiz Builder elements */
.gform-container button {
    width: auto;
    font-family: inherit;
}

.gform-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: var(--card-bg, #ffffff) !important;
    padding: 0 24px !important;
    height: 64px !important;
    min-height: 64px !important;
    border-bottom: 1px solid var(--border-color, #dadce0) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    box-sizing: border-box !important;
}

.gform-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.gform-title-input {
    font-size: 18px !important;
    border: none !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    color: var(--text-dark, #202124) !important;
    background: transparent !important;
    width: 250px !important;
}

.gform-title-input:focus {
    background: #f1f3f4 !important;
    outline: none !important;
    border-bottom: 2px solid #673ab7 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.gform-header-center {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    height: 100% !important;
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: 0 !important;
    bottom: 0 !important;
}

.gform-tab {
    background: transparent !important;
    border: none !important;
    font-size: 15px !important;
    color: var(--text-gray, #5f6368) !important;
    padding: 0 20px !important;
    height: 100% !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    border-radius: 0 !important;
    border-bottom: 3px solid transparent !important;
    margin-bottom: -1px !important;
    transition: all 0.2s ease !important;
}

.gform-tab:hover {
    color: var(--text-dark, #202124) !important;
    background: rgba(103, 58, 183, 0.04) !important;
}

.gform-tab.active {
    color: #673ab7 !important;
    border-bottom-color: #673ab7 !important;
    background: transparent !important;
}

.gform-publish-btn {
    background: #673ab7;
    color: white;
    border-radius: 4px;
    padding: 8px 24px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.save-status {
    color: #70757a;
    font-size: 14px;
    margin-left: 10px;
}

.gform-body {
    padding: 30px 20px 150px 20px;
    /* Added extra bottom padding */
    display: flex;
    justify-content: center;
    position: relative;
}

.gform-content-wrapper {
    width: 100%;
    max-width: 770px;
    position: relative;
}

/* The Cards */
.gform-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #dadce0;
    margin-bottom: 12px;
    padding: 24px;
    position: relative;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.gform-card.active-card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 6px solid #4285f4;
    border-radius: 8px;
    cursor: default;
}

.title-card {
    border-top: 10px solid #673ab7;
    padding-top: 32px;
    border-left: 1px solid #dadce0;
    border-radius: 8px;
}

.title-card.active-card {
    border-left: 6px solid #4285f4;
    border-top: 10px solid #673ab7;
    border-top-left-radius: 8px;
}

/* Inputs */
.gform-h1-input {
    font-size: 32px;
    font-weight: 400;
    width: 100%;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 4px 0;
    margin-bottom: 8px;
}

.gform-h1-input:focus {
    border-bottom: 2px solid #673ab7;
    outline: none;
}

.gform-desc-input {
    font-size: 13px;
    color: #202124;
    width: 100%;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 4px 0;
}

.gform-desc-input:focus {
    border-bottom: 2px solid #673ab7;
    outline: none;
}

/* Floating Toolbar */
.gform-floating-toolbar {
    position: absolute !important;
    right: -58px !important;
    top: 0;
    background: #ffffff !important;
    border-radius: 12px !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 6px !important;
    gap: 6px !important;
    transition: top 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
    z-index: 100 !important;
    width: auto !important;
}

.gform-floating-toolbar button {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #334155 !important;
    cursor: pointer !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    transition: all 0.2s ease !important;
}

.gform-floating-toolbar button:hover {
    background: #673ab7 !important;
    border-color: #673ab7 !important;
    color: #ffffff !important;
    transform: scale(1.06) !important;
}

.gform-floating-toolbar button:hover {
    background: #f1f3f4;
    color: #202124;
}

/* Question Block Elements */
.gform-question-header {
    display: flex;
    gap: 15px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.gform-q-input {
    flex: 1;
    background: #f1f3f4;
    border: none;
    border-bottom: 1px solid #70757a;
    border-radius: 4px 4px 0 0;
    padding: 16px;
    font-size: 15px;
}

.gform-q-input:focus {
    border-bottom: 2px solid #673ab7;
    outline: none;
    background: #e8eaed;
}

.gform-type-select {
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 12px;
    font-size: 14px;
    background: white;
    width: 200px;
    color: #202124;
}

.gform-opt-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.gform-opt-row input[type="radio"] {
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    /* Re-enables mouse clicks */
    accent-color: var(--primary-blue, #1e5eff) !important;
}

.gform-opt-input {
    flex: 1;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 4px 0;
    font-size: 14px;
}

.gform-opt-input:focus {
    border-bottom: 2px solid #673ab7;
    outline: none;
}

.gform-add-opt {
    color: #1a73e8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.gform-card-footer {
    border-top: 1px solid #dadce0;
    margin-top: 24px;
    padding-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    align-items: center;
    color: #5f6368;
}

/* --- Floating Rich Text Popup & ContentEditable Styles --- */
.rich-text-popup {
    position: fixed !important;
    z-index: 3000 !important;
    display: none;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 12px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 30px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04) !important;
    pointer-events: auto !important;
    width: auto !important;
}

.rich-text-popup select {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 20px !important;
    padding: 5px 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    outline: none !important;
    cursor: pointer !important;
    width: auto !important;
}

.rich-text-popup select:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
}

.rich-text-popup .rt-btn {
    background: transparent !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 20px !important;
    min-width: 32px !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
}

.rich-text-popup .rt-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

.rich-text-popup .rt-btn:active {
    background: #e2e8f0 !important;
}

/* Force SVGs inside buttons and containers to be clearly visible */
.gform-container svg,
.rich-text-popup svg {
    display: inline-block !important;
    vertical-align: middle !important;
    stroke: currentColor !important;
    flex-shrink: 0 !important;
}

/* Unified icon-btn styles inside Quiz Builder */
.gform-container .icon-btn,
.icon-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    padding: 0 !important;
    color: #334155 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.gform-container .icon-btn:hover,
.icon-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
    transform: translateY(-1px) !important;
}

.gform-container .icon-btn.duplicate,
.icon-btn.duplicate {
    color: #64748b !important;
}

.gform-container .icon-btn.duplicate:hover,
.icon-btn.duplicate:hover {
    background: #eff6ff !important;
    border-color: #93c5fd !important;
    color: #2563eb !important;
}

.gform-container .icon-btn.delete,
.icon-btn.delete {
    color: #64748b !important;
}

.gform-container .icon-btn.delete:hover,
.icon-btn.delete:hover {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #dc2626 !important;
}

/* Dark Theme overrides for Quiz Builder */
body.dark-theme .gform-container {
    background-color: #0b1437 !important;
}

body.dark-theme .gform-header {
    background: #111c44 !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .gform-title-input {
    color: #ffffff !important;
    background: transparent !important;
}

body.dark-theme .gform-title-input:focus {
    background: #1b254b !important;
}

body.dark-theme .gform-tab {
    color: #a3aed1 !important;
}

body.dark-theme .gform-tab:hover {
    color: #ffffff !important;
    background: rgba(139, 92, 246, 0.1) !important;
}

body.dark-theme .gform-tab.active {
    color: #a78bfa !important;
    border-bottom-color: #a78bfa !important;
}

body.dark-theme .gform-card {
    background: #111c44 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .gform-card.active-card {
    border-left-color: #6366f1 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .title-card {
    border-top-color: #8b5cf6 !important;
}

body.dark-theme .gform-h1-input {
    color: #ffffff !important;
}

body.dark-theme .gform-desc-input {
    color: #cbd5e1 !important;
}

body.dark-theme .gform-q-input,
body.dark-theme .blk-prompt {
    background: #1b254b !important;
    color: #ffffff !important;
    border-bottom-color: #475569 !important;
}

body.dark-theme .gform-q-input:focus {
    background: #24305e !important;
    border-bottom-color: #8b5cf6 !important;
}

body.dark-theme .gform-opt-input {
    color: #ffffff !important;
}

body.dark-theme .gform-type-select {
    background: #1b254b !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-theme .gform-container .icon-btn,
body.dark-theme .icon-btn {
    background: #1b254b !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #e2e8f0 !important;
}

body.dark-theme .gform-container .icon-btn:hover,
body.dark-theme .icon-btn:hover {
    background: #24305e !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

body.dark-theme .gform-container .icon-btn.delete,
body.dark-theme .icon-btn.delete {
    color: #94a3b8 !important;
}

body.dark-theme .gform-container .icon-btn.delete:hover,
body.dark-theme .icon-btn.delete:hover {
    background: #7f1d1d !important;
    border-color: #ef4444 !important;
    color: #fca5a5 !important;
}

body.dark-theme .gform-floating-toolbar {
    background: #111c44 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .gform-floating-toolbar button {
    background: #1b254b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

body.dark-theme .gform-floating-toolbar button:hover {
    background: #8b5cf6 !important;
    border-color: #8b5cf6 !important;
    color: #ffffff !important;
}

body.dark-theme .rich-text-popup {
    background: #111c44 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6) !important;
}

body.dark-theme .rich-text-popup select {
    background: #1b254b !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

body.dark-theme .rich-text-popup .rt-btn {
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #e2e8f0 !important;
}

body.dark-theme .rich-text-popup .rt-btn:hover {
    background: #1b254b !important;
    color: #ffffff !important;
    border-color: #8b5cf6 !important;
}

div.gform-h1-input,
div.gform-desc-input {
    min-height: 1.2em;
    cursor: text;
    outline: none;
}

div.gform-h1-input:empty:before {
    content: attr(data-placeholder);
    color: #70757a;
    pointer-events: none;
    display: block;
}

div.gform-desc-input:empty:before {
    content: attr(data-placeholder);
    color: #70757a;
    pointer-events: none;
    display: block;
}

div.gform-q-input {
    flex: 1;
    background: #f1f3f4;
    border: none;
    border-bottom: 1px solid #70757a;
    border-radius: 4px 4px 0 0;
    padding: 16px;
    font-size: 15px;
    min-height: 24px;
    cursor: text;
    outline: none;
}

div.gform-q-input:focus {
    border-bottom: 2px solid #673ab7;
    outline: none;
    background: #e8eaed;
}

div.gform-q-input:empty:before {
    content: attr(data-placeholder);
    color: #70757a;
    pointer-events: none;
    display: block;
}



[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: #707eae;
    pointer-events: none;
    display: block;
}

.blk-prompt,
.blk-desc {
    min-height: 24px;
    /* Prevents the div from completely collapsing */
    outline: none;
}

/* ======================================================
   RESPONSIVE MOBILE FIX (IPHONE 13 & MOBILE SCREENS)
   ====================================================== */
/* ======================================================
   RESPONSIVE MOBILE FIX (IPHONE 13 & MOBILE SCREENS)
   ====================================================== */
@media screen and (max-width: 430px) {

    /* 1. Native Page Vertical Scrolling Fix */
    html,
    body {
        width: 100% !important;
        max-width: 100vw !important;
        min-height: 100% !important;
        height: auto !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        position: relative !important;
    }

    .app-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100vw !important;
        height: auto !important;
        min-height: 100vh !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    .main-wrapper {
        width: 100% !important;
        max-width: 100vw !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 12px 32px !important;
        box-sizing: border-box !important;
    }

    /* 2. Mobile Topbar Fix (Horizontal Flex Bar across iPhone & Mobile Screens) */
    .sidebar,
    .student-sidebar {
        width: 100vw !important;
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
        padding: 0 8px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    .brand {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
    }

    .menu-bar {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        padding: 0 !important;
        width: auto !important;
        flex: 1 !important;
        margin: 0 4px !important;
        overflow: visible !important;
    }

    .menu-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
    }

    .menu-icon {
        width: 16px !important;
        height: 16px !important;
    }

    .submenu {
        margin-left: 6px !important;
        padding: 4px 0 4px 8px !important;
    }

    .user-profile-bottom {
        display: none !important;
    }

    /* 3. Topbar Header & Actions */
    .topbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 12px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .header-title h1 {
        font-size: 20px !important;
    }

    .topbar-actions {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        gap: 10px !important;
        box-sizing: border-box !important;
    }

    .theme-toggle-btn,
    .logout-btn {
        flex: 1 !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }

    .tab-content {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 4. Container & Box Overflow Fix */
    .stats-grid,
    .dashboard-grid,
    .behavior-form-row-split,
    .box div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .box {
        padding: 16px 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    /* 5. Dropdowns & Form Controls */
    .form-row,
    .form-group,
    .behavior-action-row,
    .box div[style*="display: flex"] {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 10px !important;
        align-items: stretch !important;
    }

    .box select,
    .box input:not([type="radio"]):not([type="checkbox"]),
    .box button,
    .box textarea,
    .box div[style*="display: flex"] select,
    .box header select,
    #sortPoints,
    #sortStudents,
    #filterClass,
    #filterScoreClass,
    #filterPointsClass,
    #ledgerClassSelect,
    #ledgerQuizSelect,
    #ledgerSortSelect,
    #directSubjectSelect,
    #directClassSelect,
    #directQuizSelect {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: block !important;
        box-sizing: border-box !important;
        margin: 0 0 8px 0 !important;
    }

    /* Modal Windows */
    #loginScreen,
    .modal-card,
    #quizResultsModal .box,
    #studentAnswersModal .box,
    #pointModal .box {
        width: 95% !important;
        max-width: 100% !important;
        padding: 20px 16px !important;
        border-radius: 14px !important;
    }

    /* 6. Table Touch Scrolling (Restores Vertical & Horizontal Gestures) */
    .table-responsive {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: auto !important;
        display: block !important;
        box-sizing: border-box !important;
        border-radius: 8px !important;
    }

    .table-responsive table,
    #studentsTable,
    #pointsTable,
    #behaviorTabPointsTable,
    #manageScoreTable,
    #manageNewsTable,
    #quizTable {
        width: 100% !important;
        min-width: 580px !important;
        border-collapse: collapse !important;
        white-space: nowrap !important;
    }
}


/* ======================================================
   RESPONSIVE DESIGN: IPAD & TABLET (768px to 1024px)
   ====================================================== */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .app-container {
        flex-direction: column !important;
    }

    .menu-btn {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }

    .main-wrapper {
        padding: 0 20px 28px !important;
    }

    /* 2-Column Stats Grid for iPad */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    /* Stack Dashboard Columns on iPad for Roomy Tables */
    .dashboard-grid,
    .dashboard-overview-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .table-responsive {
        max-height: 400px !important;
        overflow-x: auto !important;
    }

    /* Mobile Quiz Builder Adjustments */
    .gform-body {
        padding: 12px 8px 100px 8px;
    }

    .gform-content-wrapper {
        max-width: 100%;
    }

    .gform-floating-toolbar {
        position: fixed;
        right: 12px;
        bottom: 16px;
        top: auto !important;
        flex-direction: row !important;
        padding: 6px 12px;
        z-index: 300;
        background: #ffffff;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }

    .gform-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        padding: 12px;
    }

    .gform-header-center {
        position: static;
        transform: none;
    }

    .gform-title-input {
        width: 100%;
    }

    .gform-question-header {
        flex-direction: column !important;
    }

    .gform-type-select {
        width: 100%;
    }

    /* Forces table width on mobile so horizontal dragging works */
    .table-responsive table {
        width: 100%;
        min-width: 550px;
        /* Guarantees overflow for touch scrolling */
        border-collapse: collapse;
        white-space: nowrap;

    }
}

/* ======================================================
   DARK MODE STYLES
   ====================================================== */
body.dark-theme,
body.dark-mode {
    --bg-body: #0b1437;
    --card-bg: #111c44;
    --text-dark: #f4f7fe;
    --text-gray: #a3aed1;
    --border-color: #1b254b;
    --sidebar-bg: #080f28;
    --sidebar-hover: #152046;

    /* Dedicated Input & Box Variables for Dark Mode */
    --input-bg: #1b254b;
    --input-text: #ffffff;
    --input-placeholder: #707eae;
    --quiz-box-bg: #1b254b;

    background: #0b1437 !important;
    color: #f4f7fe !important;
}

body.dark-theme .app-container,
body.dark-mode .app-container,
body.dark-theme .main-wrapper,
body.dark-mode .main-wrapper {
    background: #0b1437 !important;
}

body.dark-theme .box,
body.dark-mode .box {
    background: #111c44 !important;
    border: 1px solid #1b254b !important;
    color: #f4f7fe !important;
}

/* Dark Mode Overrides */
body.dark-theme table,
body.dark-mode table {
    background: var(--card-bg);
}

body.dark-theme td,
body.dark-mode td {
    color: #cbd5e1;
    border-bottom-color: var(--border-color);
}

body.dark-theme input,
body.dark-mode input,
body.dark-theme select,
body.dark-mode select,
body.dark-theme textarea,
body.dark-mode textarea {
    background: #1b254b;
    color: #ffffff;
    border-color: #2b3674;
}

body.dark-theme input:focus,
body.dark-mode input:focus,
body.dark-theme select:focus,
body.dark-mode select:focus {
    background: #24305e;
}

body.dark-theme .dropdown-menu,
body.dark-mode .dropdown-menu {
    background: #111c44;
    border-color: #1b254b;
}

body.dark-theme .dropdown-item,
body.dark-mode .dropdown-item {
    color: #f4f7fe;
    border-bottom-color: #1b254b;
}

body.dark-theme .dropdown-item:hover,
body.dark-mode .dropdown-item:hover {
    background: #1b254b;
}

body.dark-theme .topbar,
body.dark-mode .topbar {
    background: var(--bg-body);
}

/* Theme Toggle Button Styling */
.theme-toggle-btn {
    background: transparent;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    width: auto;
}

.theme-toggle-btn:hover {
    background: var(--border-color);
}

/* Autocomplete Dropdown Dark Mode Overrides */
body.dark-theme .autocomplete-items {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-theme .autocomplete-items div {
    background-color: var(--card-bg);
    color: var(--text-dark);
    border-bottom-color: var(--border-color);
}

body.dark-theme .autocomplete-items div:hover {
    background-color: #1b254b;
    color: #60a5fa;
}

input::placeholder,
textarea::placeholder {
    color: var(--input-placeholder);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: var(--card-bg);
}

/* Fix Contenteditable / Question Prompt Containers */
[contenteditable="true"] {
    color: var(--text-dark) !important;
}

.gform-q-input,
.blk-prompt {
    background: var(--quiz-box-bg) !important;
    color: var(--text-dark) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

/* ======================================================
   FORM INPUTS & DROPDOWN LAYOUT FIX (SCORES & BEHAVIOR)
   ====================================================== */

/* Standardize all text inputs, number inputs, and select dropdowns */
.box input:not([type="radio"]):not([type="checkbox"]),
.box select {
    display: block !important;
    width: 100% !important;
    height: 42px !important;
    padding: 8px 14px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    border-radius: 8px !important;
    /* Restores clean rectangular box with subtle rounded corners */
    border: 1px solid var(--border-color, #e2e8f0) !important;
    background: var(--input-bg, #f8fafc) !important;
    color: var(--input-text, #2b3674) !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* Custom styling for File Upload Inputs */
.box input[type="file"] {
    padding: 4px 8px !important;
    height: 42px !important;
    line-height: 32px !important;
    cursor: pointer !important;
}

.box input[type="file"]::file-selector-button {
    background: var(--primary-blue, #1e5eff) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    margin-right: 12px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    transition: opacity 0.2s ease !important;
}

.box input[type="file"]::file-selector-button:hover {
    opacity: 0.9 !important;
}

/* Structured Form Rows & Groups */
.form-row {
    display: flex !important;
    gap: 16px !important;
    align-items: flex-end !important;
    flex-wrap: wrap !important;
    margin-bottom: 16px !important;
    width: 100% !important;
}

.form-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    flex: 1 !important;
    min-width: 180px !important;
}

.form-group label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-dark, #2b3674) !important;
    margin: 0 !important;
}

/* Consistent Action Button Height */
.box button {
    height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 20px !important;
    font-size: 14px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}

/* ======================================================
   BEHAVIOR POINT INPUT & BUTTON FLEXBOX FIX
   ====================================================== */

/* Ensure the flex wrapper spans full width */
.behavior-action-row {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    width: 100% !important;
}

/* Allocate proportional width to the number input */
#customPointValue {
    flex: 1 1 180px !important;
    min-width: 150px !important;
    height: 44px !important;
    margin: 0 !important;
}

/* Allow the button to adjust cleanly alongside the input */
#saveCustomPointBtn {
    flex: 1.5 1 auto !important;
    height: 44px !important;
    white-space: nowrap !important;
    margin: 0 !important;
}

/* ======================================================
   KEBAB DROPDOWN MENU LAYOUT OVERRIDE
   ====================================================== */

/* --- KEBAB MENU POPUP STYLING (FLAT CLEAN LIST) --- */
.dropdown-menu,
.kebab-dropdown,
.dropdown-menu.hidden,
.kebab-dropdown.hidden {
    position: absolute !important;
    right: 0 !important;
    top: 100% !important;
    background: #ffffff !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    z-index: 1000 !important;
    min-width: 190px !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    overflow: hidden !important;
    padding: 6px !important;
    display: none !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.dropdown-menu.show,
.kebab-dropdown.show,
.dropdown-menu.active,
.kebab-dropdown.active {
    display: flex !important;
    animation: fadeIn 0.15s ease-out;
}

.box .dropdown-menu button.dropdown-item,
.dropdown-menu .dropdown-item,
.kebab-dropdown .kebab-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 8px 14px !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 8px !important;
    color: var(--text-dark, #0f172a) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    text-align: left !important;
    justify-content: flex-start !important;
    cursor: pointer !important;
    box-shadow: none !important;
    white-space: nowrap !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

.dropdown-menu .dropdown-item:hover,
.kebab-dropdown .kebab-item:hover {
    background: #f1f5f9 !important;
    color: var(--primary-blue, #1e5eff) !important;
    transform: none !important;
}

.dropdown-menu .dropdown-item.danger,
.kebab-dropdown .kebab-item.danger {
    color: #ef4444 !important;
}

.dropdown-menu .dropdown-item.danger:hover,
.kebab-dropdown .kebab-item.danger:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
}

/* Dark mode overrides for kebab popups */
body.dark-theme .dropdown-menu,
body.dark-theme .kebab-dropdown {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .dropdown-menu .dropdown-item,
body.dark-theme .kebab-dropdown .kebab-item {
    color: #f8fafc !important;
}

body.dark-theme .dropdown-menu .dropdown-item:hover,
body.dark-theme .kebab-dropdown .kebab-item:hover {
    background: #334155 !important;
    color: #60a5fa !important;
}

body.dark-theme .dropdown-menu .dropdown-item.danger:hover,
body.dark-theme .kebab-dropdown .kebab-item.danger:hover {
    background: #450a0a !important;
    color: #fca5a5 !important;
}

/* ======================================================
   FORM INPUT SPACING & HEADER DROPDOWN WIDTH FIX
   ====================================================== */

/* 1. Restore vertical spacing between stacked form inputs inside boxes */
.box input:not([type="radio"]):not([type="checkbox"]) {
    margin-bottom: 12px !important;
}

/* Ensure buttons immediately below input groups have top separation */
.box button {
    margin-top: 4px !important;
}

/* 2. Prevent header dropdowns from expanding to 100% full width */
.box div[style*="display: flex"] select,
.box header select,
#sortPoints,
#sortStudents,
#filterClass,
#filterScoreClass,
#filterPointsClass {
    width: auto !important;
    min-width: 130px !important;
    max-width: 220px !important;
    display: inline-block !important;
    margin: 0 !important;
}

/* 3. Keep inputs inside flex rows (side-by-side forms) aligned without bottom margins */
.form-row input:not([type="radio"]):not([type="checkbox"]),
.form-row select,
.behavior-action-row input {
    margin-bottom: 0 !important;
}

/* ======================================================
   BEHAVIOR POINTS FORM LAYOUT FIX
   ====================================================== */

/* Form wrapper spanning full card width */
.behavior-form-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

/* Two-column layout for top inputs on desktop */
.behavior-form-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

/* ======================================================
   MOBILE KEBAB TOPBAR NAVIGATION SYSTEM (<= 768px)
   ====================================================== */

.sidebar {
    overflow: visible !important;
}

.mobile-kebab-container {
    display: none;
    position: relative;
    z-index: 999999;
}

.mobile-kebab-btn,
#mobileTopbarKebabBtn {
    background: #1e5eff !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 10px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    cursor: pointer !important;
    box-shadow: 0 3px 10px rgba(30, 94, 255, 0.45) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.mobile-kebab-btn:hover,
#mobileTopbarKebabBtn:hover {
    background: #2563eb !important;
    border-color: rgba(255, 255, 255, 0.7) !important;
    transform: scale(1.05) !important;
}

.mobile-kebab-btn:active,
#mobileTopbarKebabBtn:active {
    transform: scale(0.92) !important;
    background: #1d4ed8 !important;
}

.mobile-kebab-btn svg,
#mobileTopbarKebabBtn svg {
    width: 20px !important;
    height: 20px !important;
    stroke: #ffffff !important;
    fill: none !important;
    stroke-width: 2.2 !important;
    color: #ffffff !important;
    pointer-events: none !important;
    display: block !important;
}

body.dark-theme .mobile-kebab-btn,
body.dark-mode .mobile-kebab-btn,
body.dark-theme #mobileTopbarKebabBtn,
body.dark-mode #mobileTopbarKebabBtn {
    background: #2563eb !important;
    border: 1px solid rgba(147, 197, 253, 0.6) !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(37, 99, 235, 0.6) !important;
}

.mobile-topbar-dropdown {
    position: fixed !important;
    top: 54px !important;
    right: 12px !important;
    width: 240px !important;
    max-width: calc(100vw - 24px) !important;
    background: var(--card-bg, #ffffff) !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    border-radius: 16px !important;
    padding: 12px !important;
    box-shadow: 0 20px 45px -5px rgba(0, 0, 0, 0.45) !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    animation: kebabDropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes kebabDropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mobile-topbar-dropdown.hidden {
    display: none !important;
}

.kebab-group-label {
    font-size: 10px !important;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
    color: var(--text-gray, #64748b) !important;
    padding: 6px 10px 4px !important;
    text-transform: uppercase !important;
}

.kebab-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 12px !important;
    border-radius: 10px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: var(--text-dark, #0f172a) !important;
    text-decoration: none !important;
    background: transparent !important;
    border: none !important;
    width: 100% !important;
    text-align: left !important;
    cursor: pointer !important;
    transition: background 0.15s, color 0.15s !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
}

.kebab-item.hidden {
    display: none !important;
}

.kebab-item:hover,
.kebab-item.active {
    background: var(--input-bg, #f1f5f9) !important;
    color: var(--primary-blue, #1e5eff) !important;
}

.kebab-item.active {
    font-weight: 700 !important;
}

.kebab-divider {
    height: 1px !important;
    background: var(--border-color, #e2e8f0) !important;
    margin: 4px 0 !important;
}

.kebab-btn-danger {
    color: #ef4444 !important;
}

.kebab-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Responsive collapse for mobile devices */
@media screen and (max-width: 768px) {
    .sidebar {
        padding: 0 16px !important;
    }

    .brand {
        margin-left: 4px !important;
    }

    .brand>div:first-child,
    .brand-badge,
    .brand-logo-container {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        min-height: 30px !important;
        padding: 3px !important;
        border-radius: 7px !important;
    }

    .desktop-menu-bar,
    .desktop-user-actions {
        display: none !important;
    }

    .mobile-kebab-container {
        display: block !important;
    }

    /* Stack Quick Actions and Active News/Notices panels vertically on mobile */
    .dashboard-overview-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .dashboard-panel {
        height: auto !important;
        width: 100% !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .behavior-form-row-split {
        grid-template-columns: 1fr !important;
    }

    .topbar {
        padding: 16px 0 10px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }

    .topbar-actions.desktop-user-actions {
        display: none !important;
    }

    .main-wrapper {
        padding: 0 16px 32px !important;
    }
}

@media screen and (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Universal fix for form inputs in the Quiz Builder workspace */
input[type="text"],
input[type="number"],
input[type="url"],
textarea,
select {
    padding: 10px 14px !important;
    /* Internal spacing pushing text away from borders */
    box-sizing: border-box !important;
    /* Keeps width consistent with padding included */
    font-size: 14px;
    line-height: 1.4;
    border: 1px solid #cbd5e1;
    /* Light border definition */
    border-radius: 8px;
    /* Clean rounded corners */
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Optional focus state for cleaner user feedback when typing */
input[type="text"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Theme Toggle Button Single-Line Alignment */
.theme-toggle-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
    /* Prevents text from breaking into 2 lines */
    padding: 8px 16px !important;
    height: 42px !important;
    min-width: max-content !important;
}

.theme-toggle-btn .btn-icon {
    width: 18px !important;
    height: 18px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
}

/* Ensure circular icon containers contain image bounds properly */
.stat-icon {
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

/* Image scaling inside stat circles */
.stat-icon-img {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    object-fit: contain !important;
    display: block;
}

/* --- DASHBOARD COLUMN STACKING FIX --- */
.dashboard-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

/* --- STUDENT DIRECTORY HEADER ALIGNMENT FIX --- */
#searchStudents {
    margin: 0 !important;
    height: 36px !important;
    padding: 6px 12px !important;
    box-sizing: border-box !important;
    display: inline-block !important;
}

/* Ensure dropdowns match search bar height exactly */
#filterClass,
#sortStudents {
    height: 36px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* Dark Theme Database Subtabs */
body.dark-theme .db-subtab-nav {
    background: var(--card-bg, #111c44);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .db-pill-btn {
    color: var(--text-gray, #a0aec0);
}

body.dark-theme .db-pill-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

body.dark-theme .db-pill-btn.active {
    background: var(--primary-blue, #1e5eff);
    color: #ffffff;
}

/* --- MULTI-SELECT CHECKBOX DROPDOWN STYLING --- */
.multi-select-dropdown {
    position: relative;
    width: 100%;
    user-select: none;
}

.multi-select-trigger {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    background: var(--input-bg, #f8fafc) !important;
    color: var(--input-text, #2b3674) !important;
    cursor: pointer !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.multi-select-trigger:hover {
    border-color: var(--primary-blue, #1e5eff) !important;
}

.multi-select-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.dropdown-arrow-icon {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.multi-select-dropdown.open .dropdown-arrow-icon {
    transform: rotate(180deg);
}

.multi-select-options {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
    padding: 6px;
    box-sizing: border-box;
}

.multi-select-dropdown.open .multi-select-options {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

.multi-select-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-dark, #2b3674);
    transition: background 0.15s ease;
}

.multi-select-option-row:hover {
    background: #f1f5f9;
}

body.dark-theme .multi-select-options {
    background: #111c44;
    border-color: #2b3674;
}

body.dark-theme .multi-select-option-row {
    color: #f4f7fe;
}

body.dark-theme .multi-select-option-row:hover {
    background: #1b254b;
}

/* ======================================================
   ROUNDED PILL BUTTON STYLING SYSTEM (LIGHT & DARK THEME)
   ====================================================== */
button:not(.menu-btn):not(.submenu-btn):not(.kebab-btn):not(.dropdown-item):not(.kebab-item):not(.mobile-kebab-btn):not(#mobileTopbarKebabBtn):not(.notif-btn):not(#notifToggleBtn):not(.card-kebab-btn):not(#profileCardKebabBtn):not(.profile-dropdown-item),
.btn:not(.dropdown-item):not(.kebab-item),
.action-btn:not(.dropdown-item):not(.kebab-item),
.add-btn,
.save-btn,
.delete-btn:not(.dropdown-item):not(.kebab-item),
.modal-btn {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 24px !important;
    padding: 10px 22px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

button:not(.menu-btn):not(.submenu-btn):not(.kebab-btn):not(.dropdown-item):not(.kebab-item):not(.mobile-kebab-btn):not(#mobileTopbarKebabBtn):not(.notif-btn):not(#notifToggleBtn):not(.card-kebab-btn):not(#profileCardKebabBtn):not(.profile-dropdown-item):hover,
.btn:not(.dropdown-item):not(.kebab-item):hover,
.action-btn:not(.dropdown-item):not(.kebab-item):hover,
.add-btn:hover,
.save-btn:hover,
.delete-btn:not(.dropdown-item):not(.kebab-item):hover,
.modal-btn:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

button:not(.menu-btn):not(.submenu-btn):not(.kebab-btn):not(.dropdown-item):not(.kebab-item):not(.mobile-kebab-btn):not(#mobileTopbarKebabBtn):not(.notif-btn):not(#notifToggleBtn):active,
.btn:not(.dropdown-item):not(.kebab-item):active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

/* Dark Theme Overrides for Admin Buttons */
body.dark-theme button:not(.menu-btn):not(.submenu-btn):not(.kebab-btn):not(.dropdown-item):not(.kebab-item):not(.mobile-kebab-btn):not(#mobileTopbarKebabBtn):not(.notif-btn):not(#notifToggleBtn):not(.card-kebab-btn):not(#profileCardKebabBtn):not(.profile-dropdown-item),
body.dark-theme .btn:not(.dropdown-item):not(.kebab-item),
body.dark-theme .action-btn:not(.dropdown-item):not(.kebab-item),
body.dark-theme .add-btn,
body.dark-theme .save-btn,
body.dark-theme .delete-btn:not(.dropdown-item):not(.kebab-item),
body.dark-theme .modal-btn {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

body.dark-theme button:not(.menu-btn):not(.submenu-btn):not(.kebab-btn):not(.dropdown-item):not(.kebab-item):not(.mobile-kebab-btn):not(#mobileTopbarKebabBtn):not(.notif-btn):not(#notifToggleBtn):hover,
body.dark-theme .btn:not(.dropdown-item):not(.kebab-item):hover,
body.dark-theme .action-btn:not(.dropdown-item):not(.kebab-item):hover,
body.dark-theme .add-btn:hover,
body.dark-theme .save-btn:hover,
body.dark-theme .delete-btn:not(.dropdown-item):not(.kebab-item):hover,
body.dark-theme .modal-btn:hover {
    background: #334155 !important;
    border-color: #475569 !important;
}

/* Mobile Topbar Menu Button System */
button.mobile-kebab-btn,
.mobile-kebab-btn,
#mobileTopbarKebabBtn {
    background: #1e5eff !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 10px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    cursor: pointer !important;
    box-shadow: 0 3px 10px rgba(30, 94, 255, 0.45) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

button.mobile-kebab-btn:hover,
.mobile-kebab-btn:hover,
#mobileTopbarKebabBtn:hover {
    background: #2563eb !important;
    border-color: rgba(255, 255, 255, 0.7) !important;
    transform: scale(1.05) !important;
}

button.mobile-kebab-btn:active,
.mobile-kebab-btn:active,
#mobileTopbarKebabBtn:active {
    transform: scale(0.92) !important;
    background: #1d4ed8 !important;
}

button.mobile-kebab-btn svg,
.mobile-kebab-btn svg,
#mobileTopbarKebabBtn svg {
    width: 20px !important;
    height: 20px !important;
    stroke: #ffffff !important;
    fill: none !important;
    stroke-width: 2.2 !important;
    color: #ffffff !important;
    pointer-events: none !important;
    display: block !important;
}

body.dark-theme button.mobile-kebab-btn,
body.dark-mode button.mobile-kebab-btn,
body.dark-theme #mobileTopbarKebabBtn,
body.dark-mode #mobileTopbarKebabBtn {
    background: #2563eb !important;
    border: 1px solid rgba(147, 197, 253, 0.6) !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(37, 99, 235, 0.6) !important;
}

body.dark-theme button.mobile-kebab-btn svg,
body.dark-mode button.mobile-kebab-btn svg,
body.dark-theme #mobileTopbarKebabBtn svg,
body.dark-mode #mobileTopbarKebabBtn svg {
    stroke: #ffffff !important;
    fill: none !important;
    color: #ffffff !important;
}

/* Danger / Delete Button Pill Variant */
button.danger,
.btn.danger,
.delete-btn {
    background: #fef2f2 !important;
    color: #ef4444 !important;
    border-color: #fca5a5 !important;
}

body.dark-theme button.danger,
body.dark-theme .btn.danger,
body.dark-theme .delete-btn {
    background: #450a0a !important;
    color: #fca5a5 !important;
    border-color: #7f1d1d !important;
}

/* ======================================================
   ROUNDED MODE TOGGLE CONTAINER (MANAGE SCORE TAB)
   ====================================================== */
.register-mode-toggle {
    display: inline-flex !important;
    background: var(--input-bg, #f1f5f9) !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    border-radius: 30px !important;
    padding: 4px !important;
    gap: 4px !important;
}

.toggle-mode-btn {
    background: transparent !important;
    color: var(--text-gray, #64748b) !important;
    border: none !important;
    border-radius: 24px !important;
    padding: 8px 18px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
}

.toggle-mode-btn:hover {
    color: var(--text-dark, #0f172a) !important;
    background: rgba(255, 255, 255, 0.5) !important;
    transform: none !important;
}

.toggle-mode-btn.active {
    background: #ffffff !important;
    color: var(--primary-blue, #1e5eff) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

body.dark-theme .register-mode-toggle {
    background: #0b1437 !important;
    border-color: #1b254b !important;
}

body.dark-theme .toggle-mode-btn {
    color: #94a3b8 !important;
}

body.dark-theme .toggle-mode-btn.active {
    background: #1e293b !important;
    color: #60a5fa !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* ======================================================
   MODERN CUSTOM DROPDOWN STYLING SYSTEM
   ====================================================== */
select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: var(--card-bg, #ffffff) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231e5eff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 16px 16px !important;
    padding-right: 40px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

select:hover {
    border-color: var(--primary-blue, #1e5eff) !important;
}

body.dark-theme select,
body.dark-mode select,
.dark-theme select,
.dark-mode select {
    background-color: #0b1437 !important;
    color: #ffffff !important;
    border-color: #1b254b !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2360a5fa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 16px 16px !important;
}

body.dark-theme select option,
body.dark-mode select option,
.dark-theme select option,
.dark-mode select option {
    background-color: #0b1437 !important;
    color: #ffffff !important;
}

/* Action Kebab Button & Popup Menu */
.card-kebab-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-dark, #334155) !important;
    cursor: pointer !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    transition: all 0.15s ease !important;
}

.card-kebab-btn:hover {
    background: rgba(30, 94, 255, 0.12) !important;
    color: var(--primary-blue, #1e5eff) !important;
    border: none !important;
    transform: scale(1.1);
}

body.dark-theme .card-kebab-btn,
body.dark-mode .card-kebab-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #e2e8f0 !important;
}

body.dark-theme .card-kebab-btn:hover,
body.dark-mode .card-kebab-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #60a5fa !important;
    border: none !important;
}

.profile-card-dropdown.hidden {
    display: none !important;
}

.profile-card-dropdown {
    position: absolute !important;
    background: var(--card-bg, #ffffff) !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    padding: 6px !important;
    z-index: 9999 !important;
    min-width: 120px !important;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-dropdown-item {
    background: transparent !important;
    border: none !important;
    color: var(--text-dark, #0f172a) !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    text-align: left !important;
    transition: background 0.15s ease !important;
}

.profile-dropdown-item:hover {
    background: rgba(30, 94, 255, 0.08) !important;
    color: var(--primary-blue, #1e5eff) !important;
}

body.dark-theme .profile-card-dropdown {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .profile-dropdown-item {
    color: #e2e8f0 !important;
}

body.dark-theme .profile-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #60a5fa !important;
}