



:root {
    --primary: #007bff;
    --primary-hover: #0056b3;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --white: #fff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --body-bg: #f5f5f5;
    --card-bg: #fff;
    --border-color: #ddd;
    --border-radius: 4px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --font-family: Arial, sans-serif;
}



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

body {
    font-family: var(--font-family);
    background: var(--body-bg);
    line-height: 1.5;
    color: var(--gray-900);
}

/* ─────────────────────────────────────────────────────────────────────────
   Top navigation (tabs) + language switch + grouped dropdowns
   ───────────────────────────────────────────────────────────────────────── */

.tabs {
    display: flex;
    flex-wrap: wrap;
    background: #333;
    padding: 0;
}

.tabs .nav-desktop {
    display: flex;
    flex-wrap: wrap;
}

.tabs a {
    color: white;
    text-decoration: none;
    padding: 1rem 1.5rem;
    border-right: 1px solid #555;
    display: block;
}

.tabs a:hover { background: #555; }
.tabs a.active { background: var(--primary); }

.tabs a.logout {
    margin-left: auto;
    background: var(--danger);
    border-right: none;
}

.tabs a.logout .logout__icon {
    display: none;
}

.tabs a.logout .logout__icon svg {
    display: block;
    width: 18px;
    height: 18px;
}

.tabs a.logout .logout__text {
    display: inline;
}

.lang-switch {
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.lang-switch a {
    border: none;
    padding: 5px;
    opacity: 0.7;
}

.lang-switch a.nav-reload {
    /* legacy (reload button moved to floating action) */
    display: none;
}

/* Global floating reload button (bottom-right) */
.global-reload-fab {
    position: fixed;
    right: clamp(12px, 2vw, 18px);
    bottom: clamp(12px, 2vw, 18px);
    z-index: 999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 999px;
    background: #ffffff;
    color: #111827;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    text-decoration: none;
    font-size: 28px;
    line-height: 1;
    user-select: none;
}

.global-reload-fab:hover {
    background: #f3f4f6;
}

@media (max-width: 768px) {
    .global-reload-fab {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
}

.lang-switch a:hover { background: none; opacity: 1; }
.lang-switch a.active-lang { opacity: 1; font-weight: bold; text-decoration: underline; }

.nav-mobile { display: none; margin-left: 10px; }

/* Mobile hamburger (categories only) */
.nav-hamburger {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    line-height: 1;
    font-size: 18px;
}

.nav-hamburger-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 8px;
    right: 8px;
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    z-index: 200;
    overflow: hidden;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
}

.nav-hamburger-menu.open { display: block; }

.nav-hamburger-menu a {
    display: block;
    padding: 12px 14px;
    border-right: none;
    border-bottom: 1px solid #333;
}
.nav-hamburger-menu a:last-child { border-bottom: none; }
.nav-hamburger-menu a:hover { background: #444; }

@media (max-width: 768px) {
    .tabs .nav-desktop { display: none; }
    .tabs { position: relative; }
    .nav-mobile { display: inline-flex; align-items: center; gap: 8px; position: relative; }

    /* Mobile: keep logout small (icon only) */
    .tabs a.logout {
        padding: 0.75rem 0.9rem;
    }
    .tabs a.logout .logout__icon {
        display: inline;
        font-size: 18px;
        line-height: 1;
    }
    .tabs a.logout .logout__text {
        display: none;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
   Sub-navigation (per-module methods)
   ───────────────────────────────────────────────────────────────────────── */

.sub-nav {
    background: var(--gray-100);
    padding: 0.5rem 1rem;
    margin: 0 0 1rem 0;
    border-bottom: 1px solid var(--gray-300);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sub-nav a {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--gray-700);
    border-radius: 4px;
    transition: background 0.2s;
}

.sub-nav a:hover { background: var(--gray-200); }
.sub-nav a.active { background: var(--primary); color: var(--white); }

/* ─────────────────────────────────────────────────────────────────────────
   Category sub-navigation (modules within a category)
   ───────────────────────────────────────────────────────────────────────── */

.category-sub-nav {
    background: var(--gray-100);
    padding: 0.5rem 1rem;
    margin: 0 0 0.25rem 0;
    border-bottom: 1px solid var(--gray-300);
}

.category-sub-nav__desktop {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.category-sub-nav__desktop a {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--gray-700);
    border-radius: 4px;
    transition: background 0.2s;
}

.category-sub-nav__desktop a:hover { background: var(--gray-200); }
.category-sub-nav__desktop a.active { background: var(--primary); color: var(--white); }

.category-sub-nav__mobile { display: none; align-items: center; gap: 8px; }
.category-sub-nav__mobile-label { color: var(--gray-700); font-size: 0.9em; }
.category-sub-nav__mobile select { padding: 6px 10px; border-radius: 4px; border: 1px solid var(--gray-300); background: #fff; color: var(--gray-900); }

@media (max-width: 768px) {
    /* UX experiment: do NOT collapse category sub-nav into a select on mobile */
    /* .category-sub-nav__desktop { display: none; } */
    /* .category-sub-nav__mobile { display: inline-flex; } */
    .category-sub-nav__desktop { display: flex; }
    .category-sub-nav__mobile { display: none; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Admin Modules page (module discovery / registration UI)
   ───────────────────────────────────────────────────────────────────────── */

.upload-section { margin: 20px 0; padding: 20px; background: #e7f3ff; border-radius: 8px; }
.upload-section h3 { margin-top: 0; }
.tree-view { font-family: monospace; margin: 20px 0; }
.tree-node { margin-left: 20px; }
.dir-summary { font-weight: bold; cursor: pointer; padding: 5px 10px; background: #f8f9fa; border: 1px solid #dee2e6; margin-bottom: 2px; border-radius: 4px; }
.dir-summary:hover { background: #e9ecef; }
.file-row { display: flex; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid #eee; margin-left: 10px; }
.file-icon { margin-right: 8px; font-size: 1.2em; }
.file-content { flex: 1; }
.file-name { font-weight: bold; color: #333; }
.class-block { margin-top: 5px; padding-left: 10px; border-left: 2px solid #eee; }
.class-name { font-weight: bold; color: #555; }
.registrations-list { margin: 5px 0; }
.reg-tag { display: inline-flex; align-items: center; background: #d1e7dd; padding: 2px 8px; border-radius: 12px; margin-right: 5px; font-size: 0.9em; border: 1px solid #badbcc; }
.reg-key { font-weight: bold; margin-right: 5px; }
.action-btn { text-decoration: none; padding: 2px 8px; border-radius: 3px; font-size: 0.85em; margin-left: 5px; }
.btn-edit { background: #ffc107; color: #000; }
.btn-add { background: #0d6efd; color: white; }
.btn-delete { background: #dc3545; color: white; border: none; cursor: pointer; }



.content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}



h1 {
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

h2 {
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
}

h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}



table {
    border-collapse: collapse;
    width: 100%;
    background: var(--card-bg);
    margin: 1rem 0;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

th {
    background: var(--gray-100);
    font-weight: bold;
}

tr:hover {
    background: var(--gray-100);
}



form {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-size: 1rem;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

fieldset {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

legend {
    font-weight: bold;
    padding: 0 0.5rem;
}



button,
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    transition: background 0.2s ease;
}

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

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

.btn-success:hover {
    background: #218838;
}

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

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: var(--gray-600);
}

.btn-secondary:hover {
    background: var(--gray-700);
}

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



.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 1rem 0;
}

.card-header {
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    padding: 1rem 1.5rem;
    background: var(--gray-100);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}



.message,
.success {
    padding: 1rem;
    margin: 1rem 0;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: var(--border-radius);
    color: #155724;
}

.error {
    padding: 1rem;
    margin: 1rem 0;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: var(--border-radius);
    color: #721c24;
}

.warning {
    padding: 1rem;
    margin: 1rem 0;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: var(--border-radius);
    color: #856404;
}

.info {
    padding: 1rem;
    margin: 1rem 0;
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: var(--border-radius);
    color: #0c5460;
}



.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-box {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    width: 300px;
}

.login-box h1 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    text-align: center;
}

.login-box label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.login-box input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-sizing: border-box;
}

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







.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--gray-600);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }



@media (max-width: 768px) {
    .content {
        padding: 1rem;
    }
    
    table {
        display: block;
        overflow-x: auto;
    }
    
    .login-box {
        width: 90%;
        max-width: 300px;
    }
}
