﻿@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

/* ── Design tokens ───────────────────────────────── */

:root {
    --bg: #f7f8fc;
    --surface: #ffffff;
    --surface-hover: #f3f4f6;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-muted: rgba(99, 102, 241, 0.10);
    --success: #10b981;
    --success-muted: rgba(16, 185, 129, 0.10);
    --danger: #ef4444;
    --danger-muted: rgba(239, 68, 68, 0.10);
    --warning: #f59e0b;
    --warning-muted: rgba(245, 158, 11, 0.10);
    --info: #3b82f6;
    --info-muted: rgba(59, 130, 246, 0.10);
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --radius-card: 12px;
    --radius-island: 16px;
}

html.dark {
    --bg: #0f0f13;
    --surface: #1a1a24;
    --surface-hover: #252535;
    --accent: #7c5cfc;
    --accent-hover: #6366f1;
    --accent-muted: rgba(124, 92, 252, 0.12);
    --success: #10b981;
    --success-muted: rgba(16, 185, 129, 0.12);
    --danger: #f87171;
    --danger-muted: rgba(248, 113, 113, 0.12);
    --warning: #fbbf24;
    --warning-muted: rgba(251, 191, 36, 0.10);
    --info: #60a5fa;
    --info-muted: rgba(96, 165, 250, 0.12);
    --text-primary: #f9fafb;
    --text-secondary: #a0a0b0;
    --border: #2d2d3d;
    --shadow: 0 4px 24px rgba(0,0,0,0.30);
}

/* ── Base ────────────────────────────────────────── */

html, body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    transition: background-color 0.2s ease, color 0.2s ease;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--accent);
}

.btn-primary {
    color: #fff;
    background-color: var(--accent);
    border-color: var(--accent);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    border: 1px solid #26b050;
    border-radius: 5px;
}

.invalid {
    border: 1px solid red;
    border-radius: 5px;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }


/* For modern browsers */
input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    right: 0 !important;
}

/* For Firefox */
input[type="password"] {
    -moz-appearance: textfield !important;
}

    /* For Microsoft Edge */
    input[type="password"]::-ms-reveal {
        display: none !important;
    }

/*????????????????????????????????????????????????????????????????*/


/* Apply Bootstrap's border and background styles to CKEditor */
.cke {
    border: 1px solid #ced4da; /* Bootstrap's border style */
    border-radius: 0.25rem; /* Bootstrap's border radius */
}

.cke_toolbar {
    background-color: #f8f9fa; /* A light background similar to Bootstrap's forms */
    border-bottom: 1px solid #ced4da; /* Bootstrap-like separation */
}

.cke_button {
    color: #495057; /* Bootstrap's default text color */
    background-color: #e9ecef; /* Bootstrap's light background for elements */
    border: 1px solid #ced4da; /* Bootstrap's border */
    border-radius: 0.2rem; /* Slightly rounded borders for buttons */
}

/* Adjusting padding and margins to match Bootstrap's feel */
.cke_button_icon {
    padding: 0.25rem;
}

.cke_button__bold_icon, .cke_button__italic_icon, .cke_button__underline_icon {
    /* Example to adjust specific button icons */
}


.shimmer {
    background: linear-gradient(90deg, var(--border) 25%, var(--surface-hover) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmerAnimation 1.5s infinite;
    border-radius: 15px;
    height: 40px;
    margin-bottom: 10px;
}

@keyframes shimmerAnimation {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}


.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 160px;
}

/*//////////////////////////*//**/
.loader-wrapper {
    display: flex;
    flex-direction: column;
    align-content: center;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.mud-tab.mud-tab-active.mud-ripple {
    color: var(--accent) !important;
}

.mud-datagrid-max-height {
    max-height: 500px; /* Adjust this value as per your requirement */
    overflow-y: auto;
}


.mud-table-fixed-header thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}


/* Apply the same image styles to both question and answer containers */
.test img,
.question-text img,
.answer-item img {
    max-width: 100%; /* Prevents images from exceeding container width */
    height: auto; /* Maintains aspect ratio */
    display: block; /* Ensures no inline spacing issues */
    margin: 10px 0; /* Adds vertical spacing around images */
    border-radius: 5px; /* Optional: Adds rounded corners */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Optional: Adds subtle shadow */
}

/* Prevent images from exceeding a certain height */
.test img,
.question-text img,
.answer-item img {
    max-height: 500px; /* Restrict maximum height for better fitting */
    object-fit: contain; /* Ensures the entire image fits within the max-height */
}

.quiz-question img,
.options-list img {
    max-width: 100%; /* Prevents images from exceeding container width */
    height: auto; /* Maintains aspect ratio */
    display: block; /* Ensures no inline spacing issues */
    margin: 10px 0; /* Adds vertical spacing around images */
    border-radius: 5px; /* Optional: Adds rounded corners */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Optional: Adds subtle shadow */
}

/* Prevent images from exceeding a certain height */
.quiz-question img,
.options-list img {
    max-height: 500px; /* Restrict maximum height for better fitting */
    object-fit: contain; /* Ensures the entire image fits within the max-height */
}

.test p {
    margin-bottom: 0;
    align-content: center;
}

.mud-data-grid .mud-table-cell .column-header {
    font-weight: bold;
}

.error-container {
    position: relative;
    background-color: #ff7575;
    height: 60px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 10px;
}

.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white !important;
    width: 80%;
}

/* ── Admin shell layout (US-02) ───────────────── */

.admin-shell {
    display: flex;
    min-height: 100vh;
    background: var(--bg, #f7f8fc);
}

.admin-content {
    flex: 1;
    padding: 80px 24px 24px 24px;
    transition: margin-left 0.25s ease;
    min-width: 0;
}

.taker-shell {
    min-height: 100vh;
    background: var(--bg, #f7f8fc);
}

/* ── Sidebar structural layout (global — scoped CSS unreliable for flex) */

.sidebar-island {
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: 260px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    z-index: 100;
}

.sidebar-island.collapsed {
    width: 72px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 16px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-header--collapsed {
    justify-content: center;
    padding: 16px 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    min-width: 0;
}

.sidebar-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: background 0.15s ease;
    line-height: 0;
}

.sidebar-collapse-btn:hover {
    background: var(--surface-hover);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav a.nav-item,
a.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}

.sidebar-nav a.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-nav a.nav-item.nav-item--active {
    background: var(--accent-muted);
    color: var(--accent);
}

.sidebar-label {
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-bottom {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    overflow: hidden;
}

.sidebar-avatar-initial {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.sidebar-username {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.nav-icon {
    flex-shrink: 0;
    font-size: 1.2rem !important;
}

/* ── Auth social buttons (global — scoped CSS can't reach MudBlazor internals) */

.auth-social-btn {
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: 10px !important;
    text-transform: none !important;
    font-weight: 500 !important;
}

.auth-social-btn:hover {
    background-color: var(--surface-hover) !important;
}

/* ── Admin top bar ─────────────────────────────────── */

.admin-topbar {
    position: fixed;
    top: 12px;
    right: 12px;
    height: 56px;
    background: var(--surface);
    box-shadow: var(--shadow);
    border-radius: var(--radius-island);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 8px;
    gap: 2px;
    z-index: 99;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.admin-topbar .mud-icon-button {
    color: var(--text-secondary) !important;
    border-radius: 10px !important;
}

.admin-topbar .mud-icon-button:hover {
    color: var(--text-primary) !important;
    background: var(--surface-hover) !important;
}

.admin-topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

/* ── MudBlazor outlined input: fix label background in dark mode */

html.dark .mud-input-label-outlined {
    background-color: var(--surface) !important;
    color: var(--text-secondary) !important;
}

html.dark .mud-input-outlined fieldset {
    border-color: var(--border) !important;
}

html.dark .mud-input-slot {
    color: var(--text-primary) !important;
}

html.dark .mud-input-adornment,
html.dark .mud-input-adornment button,
html.dark .mud-input-adornment .mud-icon-root,
html.dark .mud-input-adornment .mud-inherit-text {
    color: #ffffff !important;
}

/* ── Browser autofill override (Chrome blue/yellow background hack) */

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0px 1000px var(--surface) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 0s ease-in-out 9999s;
}

/* ── Page layout utilities (US-13..US-16) ──────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-heading {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.page-new-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

.page-new-btn:hover { opacity: 0.88; }

.page-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.page-back-btn:hover {
    background: var(--accent-muted);
    color: var(--accent);
}

.page-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.page-icon-btn:hover {
    background: var(--accent-muted);
    color: var(--accent);
    border-color: var(--accent);
}

/* ── Data card: wraps a MudDataGrid with token-based styling ── */

.data-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* ── Section card: for detail page sections ── */

.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Sticky DataGrid column — dark-mode-safe background ── */

.sticky-column {
    background: var(--surface) !important;
}

/* ── Fix sticky table header background ── */

.mud-table-fixed-header thead th {
    background: var(--surface) !important;
}

/* ── Focus visible (all native buttons) ──────────── */

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Skeleton animation ────────────────────────── */

.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--surface-hover) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}