/* OMR Scanner — app theme (login / tool / result pages).
   Matches the public landing page: all colour comes from theme-tokens.css
   (blue & white by default, dark via the toggle) — nothing is hardcoded
   here. Selectors and markup are unchanged from the original — only colour,
   border and font values. */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--body);
    background-color: var(--bg);
    color: var(--fg);
}

/* Container */
.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 300px;
    background: var(--bg-raised);
    color: var(--fg);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid var(--line);
}

.sidebar .brand {
    margin-bottom: 30px;
    text-align: center;
}

.sidebar .brand-logo {
    width: 150px;
    height: auto;
    margin-bottom: 10px;
}

.sidebar .brand h2 {
    font-family: var(--display);
    font-size: 24px;
    margin: 0;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar .brand h2 i {
    color: var(--accent);
}

/* Options Form Styles */
.options-form {
    width: 100%;
}

.selection-cards {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.card {
    background-color: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-tight);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, background-color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.card:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.card.active {
    background-color: var(--accent-soft);
    border-color: var(--accent);
}

.card h3 {
    font-size: 18px;
    color: var(--fg);
}

.card i {
    font-size: 24px;
    color: var(--fg);
}

/* Main Content Styles */
.main-content {
    flex: 1;
    padding: 60px 80px;
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center vertically */
    gap: 40px;
    position: relative; /* Added for positioning the back button */
}

/* Back Button Styles */
.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.back-button a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    background-color: var(--accent);
    color: var(--accent-ink);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--accent);
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.back-button a:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
}

/* Content Container Styles */
.content-container {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center horizontally */
    width: 100%;
}

/* Centered Content */
.centered-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 30px;
}

.logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.logo {
    width: 250px;
    height: auto;
}

.main-content h1 {
    font-family: var(--display);
    font-size: 36px;
    margin-bottom: 10px;
    color: var(--fg);
    text-align: center;
    letter-spacing: -0.01em;
}

.main-content p {
    font-size: 16px;
    color: var(--muted);
    margin-bottom: 20px;
    text-align: center;
    max-width: 600px;
}

/* File Input Styles */
.file-input {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
    text-align: center;
}

.file-input input[type="file"] {
    display: none;
}

.file-input label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 30px;
    background-color: var(--accent);
    color: var(--accent-ink);
    font-size: 16px;
    font-weight: 600;
    border: 1px solid var(--accent);
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.file-input label i {
    margin-right: 10px;
}

.file-input label:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
}

/* Submit Button Styles (Removed in index.html) */
.submit-button {
    text-align: center;
    margin-top: 20px;
}

.submit-button button {
    padding: 12px 25px;
    background-color: var(--accent);
    color: var(--accent-ink);
    font-size: 16px;
    font-weight: 600;
    border: 1px solid var(--accent);
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.submit-button button:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
}

/* Result Styles */
#result {
    max-width: 100%;
    text-align: center;
    margin-top: 20px;
}

#result img {
    max-width: 100%;
    width: 400px;
    height: auto;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
}

/* Images Container */
.images-container {
    display: flex;
    flex-direction: row;
    gap: 40px;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
    margin-top: 30px;
}

.image-section {
    flex: 1;
    min-width: 300px;
    text-align: center;
}

.image-section h2 {
    font-family: var(--display);
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--fg);
}

.image-section img {
    width: 100%;
    height: auto;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-tight);
}

/* OMR Response Container */
.omr-response-container {
    width: 100%;
    max-width: 1200px;
    margin-top: 40px;
    text-align: center;
}

.omr-response-container h2 {
    font-family: var(--display);
    font-size: 28px;
    margin-bottom: 30px;
    color: var(--fg);
}

.omr-rows {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

/* Improved OMR Row Styles */
.omr-row {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

/* Enhanced OMR Card Styles */
.omr-card {
    background-color: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 5px;
    width: calc(10% - 20px); /* Adjust based on number per row */
    min-width: 50px;
    padding: 10px;
    transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.omr-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    background-color: var(--accent-soft);
}

.omr-card .card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.omr-card .question {
    font-weight: bold;
    font-size: 14px; /* Adjusted font size */
    margin-bottom: 8px;
    color: var(--accent);
}

.omr-card .answer {
    font-size: 14px; /* Adjusted font size */
    color: var(--muted);
}

/* Responsive Styles for Result Page */
@media screen and (max-width: 1200px) {
    .omr-card {
        width: calc(10% - 20px);
    }
}

@media screen and (max-width: 992px) {
    .images-container {
        flex-direction: column;
        align-items: center;
    }

    .omr-card {
        width: calc(15% - 20px);
    }
}

@media screen and (max-width: 768px) {
    .images-container {
        flex-direction: column;
        align-items: center;
    }

    .image-section {
        width: 90%;
    }

    .omr-card {
        width: calc(20% - 15px);
    }
}

@media screen and (max-width: 480px) {
    .omr-card {
        width: calc(33.33% - 16px);
        padding: 10px;
    }

    .omr-card .question {
        font-size: 14px;
    }

    .omr-card .answer {
        font-size: 12px;
    }

    .back-button a {
        font-size: 14px;
    }

    .results-container {
        gap: 20px;
    }
}

/* Error Message Styles */
.error {
    color: var(--err);
    font-weight: bold;
    text-align: center;
    margin-top: 20px;
}

/* Login / OTP Screen Styles */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 40px 36px;
    text-align: center;
}

.login-top {
    position: absolute;
    top: 16px;
    right: 16px;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.login-brand i {
    font-size: 34px;
    color: var(--accent);
}

.login-brand h1 {
    font-family: var(--display);
    font-size: 26px;
    color: var(--fg);
    letter-spacing: -0.01em;
}

.login-subtitle {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 24px;
}

.login-info {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    color: var(--fg);
    border-radius: var(--radius-tight);
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 18px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.login-form label {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.login-form input {
    width: 100%;
    padding: 13px 16px;
    font-size: 16px;
    font-family: var(--body);
    background: var(--bg-raised);
    color: var(--fg);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-tight);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

#otp {
    letter-spacing: 6px;
    text-align: center;
    font-size: 22px;
}

.login-btn {
    margin-top: 8px;
    padding: 13px 20px;
    background-color: var(--accent);
    color: var(--accent-ink);
    font-size: 16px;
    font-weight: 600;
    font-family: var(--body);
    border: 1px solid var(--accent);
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
}

.login-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    gap: 12px;
}

.login-links form {
    margin: 0;
}

.link-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 14px;
    font-family: var(--body);
    cursor: pointer;
    text-decoration: none;
    padding: 0;
}

.link-btn:hover {
    color: var(--accent);
    text-decoration: underline;
}

.login-footer {
    margin-top: 22px;
    color: var(--dim);
    font-size: 13px;
}

/* Logout button (shown on authenticated pages) */
.logout-button {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logout-button a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    background-color: transparent;
    color: var(--muted);
    border: 1px solid var(--line-2);
    padding: 10px 15px;
    border-radius: 999px;
    font-size: 14px;
    transition: border-color 0.2s, color 0.2s, transform 0.2s;
}

.logout-button a:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

/* Responsive Styles */
@media screen and (max-width: 1200px) {
    .omr-card {
        width: calc(10% - 20px);
    }
}

@media screen and (max-width: 992px) {
    .main-content {
        padding: 50px 40px;
    }

    .logo {
        width: 200px;
    }

    .main-content h1 {
        font-size: 30px;
    }

    .main-content p {
        font-size: 16px;
        max-width: 500px;
    }

    .top-section {
        flex-direction: column;
        align-items: center;
    }

    .left-section, .right-section {
        width: 100%;
    }

    #result img {
        width: 80%;
    }

    .results-container {
        flex-direction: column;
        gap: 30px;
    }

    .omr-cards-container {
        gap: 15px;
    }

    .omr-card {
        width: calc(25% - 20px);
    }
}

@media screen and (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
        padding: 20px 10px;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }

    .sidebar .brand {
        margin-bottom: 0;
    }

    .selection-cards {
        flex-direction: row;
    }

    .card {
        flex: 1;
        margin: 0 5px;
    }

    .main-content {
        padding: 40px 20px;
    }

    .logo {
        width: 180px;
    }

    .main-content h1 {
        font-size: 28px;
    }

    .file-input label {
        padding: 12px 25px;
        font-size: 14px;
    }

    .omr-response h3 {
        font-size: 24px;
    }

    .omr-cards-container {
        gap: 10px;
    }

    .omr-card {
        width: calc(25% - 15px);
    }

    .omr-card .question {
        font-size: 16px;
    }

    .omr-card .answer {
        font-size: 20px;
    }

    .results-container {
        flex-direction: column;
        align-items: center;
    }

    .result-image, .omr-response {
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .main-content h1 {
        font-size: 24px;
    }

    .main-content p {
        font-size: 14px;
        max-width: 100%;
    }

    .file-input label {
        padding: 10px 20px;
        font-size: 12px;
    }

    #result img {
        width: 100%;
    }

    .omr-response h3 {
        font-size: 20px;
    }

    .omr-cards-container {
        gap: 8px;
    }

    .omr-card {
        width: calc(33.33% - 16px);
        padding: 10px;
    }

    .omr-card .question {
        font-size: 14px;
    }

    .omr-card .answer {
        font-size: 18px;
    }

    .back-button a {
        font-size: 14px;
    }

    .results-container {
        gap: 20px;
    }
}
