body {
	margin: 0;
	color: #6a6f8c;
	background: #c8c8c8;
	font: 600 16px/18px 'Open Sans', sans-serif;

}

:root {
    --site-header-height: 64px; /* fallback until JS measures the real header height */
}

*,
:after,
:before {
	box-sizing: border-box;
}
.clearfix:after,
.clearfix:before {
	content: '';
	display: table;
}
.clearfix:after {
	clear: both;
	display: block;
}
a {
	color: inherit;
	text-decoration: none;
}
.login-page {
	display: flex;
	align-items: center;
	justify-content: center;
    min-height: auto;
}

.login-wrap {
        width: 100%;
        max-width: min(480px, 95vw); /* DROP-IN: allow the card to breathe on narrow viewports */
        position: relative;
        background: #496f89;
        box-shadow: 0 12px 15px 0 rgba(0, 0, 0, .24), 0 17px 50px 0 rgba(0, 0, 0, .19);
        border-radius: 10px;
        overflow: hidden;
}

.login-html {
	width: 100%;
	padding: 40px 30px;
	background: rgba(40, 57, 101, .9);
	position: relative;
}

.login-html .sign-in-htm,
.login-html .sign-up-htm {
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	position: absolute;
	transform: rotateY(180deg);
	backface-visibility: hidden;
	transition: all 0.4s linear;
}

.login-html .sign-in,
.login-html .sign-up,
.login-form .group .check {
	display: none;
}

.login-html .tab,
.login-form .group .label,
.login-form .group .button {
	text-transform: uppercase;
}

.login-html .tab {
	font-size: 22px;
	padding-bottom: 5px;
	margin: 0 15px 10px 0;
	display: inline-block;
	border-bottom: 2px solid transparent;
}

.login-html .sign-in:checked + .tab,
.login-html .sign-up:checked + .tab {
	color: #fff;
	border-color: #1161ee;
}

.login-form {
	min-height: 345px;
	position: relative;
	perspective: 1000px;
	transform-style: preserve-3d;
}

.login-form .group {
	margin-bottom: 15px;
}

.login-form .group .label,
.login-form .group .input,
.login-form .group .button {
	width: 100%;
	color: #fff;
	display: block;
}

.login-form .group .input,
.login-form .group .button {
	border: none;
	padding: 15px 20px;
	border-radius: 25px;
	background: rgba(255, 255, 255, .1);
}

.login-form .group .label {
	color: #aaa;
	font-size: 12px;
}

.login-form .group .button {
	background: #1161ee;
}

.login-form .group label .icon {
	width: 15px;
	height: 15px;
	border-radius: 2px;
	position: relative;
	display: inline-block;
	background: rgba(255, 255, 255, .1);
}

.login-form .group label .icon:before,
.login-form .group label .icon:after {
	content: '';
	width: 10px;
	height: 2px;
	background: #fff;
	position: absolute;
	transition: all .2s ease-in-out 0s;
}

.login-form .group label .icon:before {
	left: 3px;
	width: 5px;
	bottom: 6px;
	transform: scale(0) rotate(0);
}

.login-form .group label .icon:after {
	top: 6px;
	right: 0;
	transform: scale(0) rotate(0);
}

.login-form .group .check:checked + label {
	color: #fff;
}

.login-form .group .check:checked + label .icon {
	background: #1161ee;
}

.login-form .group .check:checked + label .icon:before {
	transform: scale(1) rotate(45deg);
}

.login-form .group .check:checked + label .icon:after {
	transform: scale(1) rotate(-45deg);
}

.login-html .sign-in:checked + .tab + .sign-up + .tab + .login-form .sign-in-htm {
	transform: rotate(0);
}

.login-html .sign-up:checked + .tab + .login-form .sign-up-htm {
	transform: rotate(0);
}

.hr {
	height: 2px;
	margin: 60px 0 50px 0;
	background: rgba(255, 255, 255, .2);
}

.error-message {
	color: red;
	font-size: 0.9em;
	margin-top: 4px;
	display: none;
}

.input.error {
	border: 2px solid red;
}

/* DROP-IN: Modal now inherits the base font to keep typography consistent */
.modal {
        display: none;
        position: fixed;
        z-index: 9999;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        justify-content: center;
        align-items: center;
        font-family: inherit;
}

.modal-content {
	position: relative;
	background-color: #fdfdfd;
	padding: 30px 30px 20px;
	border-radius: 12px;
	width: 90%;
	max-width: 400px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	text-align: center;
	animation: fadeIn 0.3s ease-in-out;
}

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

.close-button {
	position: absolute;
	top: 10px;
	right: 15px;
	font-size: 24px;
	color: #888;
	cursor: pointer;
	transition: color 0.2s ease;
}

.close-button:hover {
	color: #444;
}

.modal-title {
	margin-bottom: 20px;
	font-size: 20px;
	color: #333;
}

.modal-group {
	margin-bottom: 20px;
	text-align: left;
}

.modal-label {
	display: block;
	margin-bottom: 8px;
	font-weight: 500;
	color: #333;
	font-size: 14px;
}

.modal-input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ccc;
	border-radius: 6px;
	font-size: 15px;
	box-sizing: border-box;
	transition: border-color 0.2s ease;
}

.modal-input:focus {
	outline: none;
	border-color: #007bff;
}

.modal-button {
	width: 100%;
	padding: 12px;
	background-color: #007bff;
	color: white;
	border: none;
	border-radius: 6px;
	font-size: 15px;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.modal-button:hover {
	background-color: #0056b3;
}

/* ===== Side-by-side layout for login (left) + intro (right) ===== */
/* DROP-IN: consolidated auth layout rules and responsive behavior */
.auth-layout{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:32px; /* DROP-IN: single desktop gap */
    min-height:calc(100vh - var(--site-header-height));
    padding:24px 16px;
    flex-wrap:wrap;
}

/* DROP-IN: unified sizing for paired cards */
.auth-layout .login-page{
    height:auto;
    display:flex;
    align-items:center;
    justify-content:center;
    flex: 1 1 420px;
    max-width:480px;
}

.intro-card{
    width:100%;
    max-width:min(520px, 95vw); /* DROP-IN: fluid cap for mid-sized screens */
    border-radius:10px;
    background: linear-gradient(135deg, rgba(40,57,101,0.95), rgba(73,111,137,0.9));
    box-shadow: 0 12px 15px rgba(0,0,0,.24), 0 17px 50px rgba(0,0,0,.19);
    padding:24px;
    color:#fff;
    flex: 1 1 420px;
}

/* Keep your intro text styles */
.intro-lead{
    margin:0 0 14px;
    font-weight:600;
    color:#dfe6ff;
}
.intro-features{
    margin:0 0 14px 0;
    padding-left:18px;
    color:#e9efff;
}
.intro-features li{ margin:6px 0; }

/* Admin edit question page*/
.admin-textarea {
    width: 100% !important;     /* override any global width constraints */
    min-width: 0;               /* allow shrinking within grid */
    box-sizing: border-box;     /* include padding in width */
    padding: 8px;
    min-height: 110px;
    resize: vertical;           /* let you grow/shrink as needed */
}

/* Make the two-column editor grid flexible and prevent min-content squeeze */
.admin-options-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

/* Defensive: some themes set max-width on textareas */
.admin-options-grid textarea {
    max-width: none !important;
}

/* Accent for ADMIN rows in presence table */
.admin-accent {
    color: #3498db;   /* blue in your palette family */
    font-weight: 700; /* bold */
}

/* ======= Public pages styling (matching app look) ======= */

/* Layout */
.container {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Section wrappers */
.section {
    background: #f6f8fb;
    border: 1px solid #e7edf5;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

/* Hero (gradient, like intro card) */
.page-hero {
    border-radius: 16px;
    padding: 28px 24px;
    color: #fff;
    background: linear-gradient(135deg, rgba(40,57,101,0.95), rgba(73,111,137,0.9));
    box-shadow: 0 12px 24px rgba(0,0,0,.18), 0 18px 40px rgba(0,0,0,.14);
    margin: 18px 0 22px;
}
.page-hero h1 {
    margin: 0 0 8px 0;
    font-size: 26px;
    line-height: 1.25;
    color: #fff;
}
.page-hero p.lead {
    margin: 6px 0 14px;
    color: #e9efff;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    transition: transform .06s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
    user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
    background: #1161ee;
    color: #fff;
    box-shadow: 0 6px 14px rgba(17,97,238,.25);
}
.btn.primary:hover { background: #0f55cf; }
.btn.ghost {
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,.3);
}
.btn.ghost:hover { background: rgba(255,255,255,.22); }

/* Grid for features / topic cards */
.grid {
    display: grid;
    gap: 14px;
}
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

/* Cards */
.card {
    background: #ffffff;
    border: 1px solid #e8edf3;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.05);
}
.card h3 {
    margin: 0 0 8px;
    color: #283965;
    font-size: 18px;
}
.card p { margin: 6px 0 0; }

/* Lists */
.clean-list { margin: 0; padding-left: 18px; }
.clean-list li { margin: 6px 0; }

/* Topic list styling */
.topic-card h2 {
    margin: 0 0 10px;
    font-size: 20px;
    color: #283965;
}
.subtopic-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.pill {
    background: #f1f5fb;
    border: 1px solid #e3ebf6;
    color: #3b4a76;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
}

/* Minor helpers */
.kicker {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    color: #dfe6ff;
    margin-bottom: 8px;
    font-size: 13px;
    letter-spacing: 0.3px;
}
.sep { height: 1px; background: #e9eef6; margin: 14px 0; }

/* Improved table rendering in dashboard for mobile devices */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-responsive table {
    min-width: 600px;  /* keeps columns readable; table scrolls horizontally on phone */
}

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {

    /* 1. Stack the Login and Intro cards vertically */
    .auth-layout {
        flex-direction: column;
        padding: 15px;
        gap: 20px;
    }

    .login-wrap,
    .intro-card {
        border-radius: 0;
    }

    .auth-layout .login-page,
    .auth-layout .intro-card {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
    }

    /* 2. Fix the Login Card Container */
    .login-wrap {
        max-width: 100%;
        height: auto;
        min-height: auto;
        box-shadow: 0 8px 14px rgba(0,0,0,0.22);
    }

    /* 3. DISABLE 3D FLIP - The Critical Fix */
    /* Remove fixed height so container grows with content */
    .login-form {
        min-height: auto;
        padding-bottom: 20px; /* Add breathing room at bottom */
    }

    /* Reset positioning so the form flows naturally */
    .login-html .sign-in-htm,
    .login-html .sign-up-htm {
        position: relative;
        top: auto;
        left: auto;
        transform: none; /* Remove rotation */
        display: none;   /* Hide both by default */
    }

    /* 4. LOGIC: Show the correct form based on Radio Button */
    /* When "Sign In" radio is checked, show Sign In form */
    .login-html .sign-in:checked + .tab + .sign-up + .tab + .login-form .sign-in-htm {
        display: block;
        transform: none;
    }

    /* When "Sign Up" radio is checked, show Sign Up form */
    .login-html .sign-up:checked + .tab + .login-form .sign-up-htm {
        display: block;
        transform: none;
    }

    /* 5. Visual Tweak: Adjust Tabs */
    .login-html {
        padding: 20px 20px;
    }

    .login-html .tab {
        font-size: 18px;
        margin-right: 15px;
    }

    /* 6. Visual Tweak: Inputs */
    .login-form .group .input,
    .login-form .group .button {
        padding: 12px 15px;
    }

    /* 7. Intro Card Typography */
    .intro-lead {
        font-size: 15px;
        line-height: 1.5;
    }
}

@media (max-height: 520px) and (orientation: landscape){
    /* Landscape phones have height constraints; stack to prevent cramped overlap */
    .auth-layout{
        flex-direction: column;
        align-items: stretch;
        padding-inline: 12px;
        gap: 16px;
    }
    .auth-layout .login-page,
    .auth-layout .intro-card{
        flex: 1 1 auto;
        max-width: 100%;
        width: 100%;
    }
}
@media (max-width: 640px){
    .intro-card{ padding:18px; }
    .auth-layout{ gap: 12px; }
}

/* Extra tightening for small phones */
@media (max-width: 480px) {

    body {
        font-size: 14px;
        line-height: 1.4;
    }

    .auth-layout {
        padding: 16px 10px;
        gap: 8px;
    }

    .auth-layout .login-page,
    .auth-layout .intro-card {
        max-width: 100%;
    }

    /*!* Let the card grow and scroll on small screens *!*/
    /*.login-page {*/
    /*    align-items: flex-start;*/
    /*    min-height: auto;*/
    /*    padding-top: 12px;*/
    /*}*/

    .login-wrap {
        max-width: 100%;
        box-shadow: 0 8px 14px rgba(0,0,0,0.22);
        overflow: visible;
    }

    .login-html {
        padding: 24px 20px;
    }

    .login-form {
        min-height: auto;
    }

    .login-html .sign-in-htm,
    .login-html .sign-up-htm {
        position: relative; /* Change from absolute to relative on mobile */
    }

    .login-html .tab {
        font-size: 18px;
        margin-right: 10px;
    }

    .login-form .group .input,
    .login-form .group .button {
        padding: 10px 14px;
        border-radius: 20px;
    }

    .intro-card {
        padding: 16px 14px;
    }

    .intro-lead {
        font-size: 16px;
    }

    .intro-features {
        font-size: 14px;
    }
}

.intro-lead {
    margin: 12px 0 0;
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.6;
}

/* --- FOOTER --- */
.site-footer {
    text-align: center;
    padding: 5px 0;
    margin-top: 5px;
    font-size: 0.75rem;
    color: #7f8c8d; /* Subtle gray, readable on your background */
    width: 100%;
}

.site-footer p {
    margin: 2px 0;
    line-height: 1.3;
}

.site-footer .disclaimer {
    font-size: 0.7rem; /* Smaller font for the legal text */
    opacity: 0.8;
}

/* Optional: Make it look nice on mobile */
@media (max-width: 480px) {
    .site-footer {
        padding: 20px 10px 40px 10px; /* Extra bottom padding for scrolling feel */
        font-size: 0.8rem;
    }
}

/* ===== Admin question search modal (fixed viewport, sticky header/footer) ===== */
.qsearch-modal-content{
    width: 90vw;        /* ~90% of viewport width */
    max-width: 1400px;  /* cap for very wide screens */
    text-align: left;

    /* critical: keep modal inside viewport */
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* prevent modal expanding beyond viewport */
}

.qsearch-modal-header{
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fdfdfd;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.qsearch-modal-close{
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    color: #888;
    padding: 2px 8px;
}
.qsearch-modal-close:hover{ color:#444; }

.qsearch-modal-body{
    padding: 12px;
    overflow: auto; /* this is the scroll container */
}

.qsearch-results-box{
    /* results scroll within the body; not required but keeps it neat */
    max-height: 24vh;
    overflow: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
}

.qsearch-modal-footer{
    position: sticky;
    bottom: 0;
    background: #fdfdfd;
    padding: 10px 0 0;
    border-top: 1px solid #eee;

    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Force wide admin search modal (overrides base .modal-content max-width:400px) */
#qsearch-modal .modal-content.qsearch-modal-content{
    width: 90vw !important;
    max-width: 1400px !important;
}