﻿/* Modern Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main, #334155);
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Global Theme Transition */
body,
.card,
.input-text,
.input-textarea,
.option-pill,
.btn,
.page-wrap,
.question-text,
.label-main,
.info-text,
.logo-img {
    transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        filter 0.5s ease;
}

.info-text {
    color: var(--text-main);
}

:root {
    /* Safe Blue Theme (Light) */
    --primary: #0044eb;
    --primary-hover: #0033b3;
    --text-main: #334155;
    --text-muted: #64748b;
    --bg-gradient: radial-gradient(circle at top right, #e0f2fe, #f0f9ff 40%, #eef2ff);
    --card-bg: rgba(255, 255, 255, 0.85);
    /* Increased transparency */
    --card-border: rgba(255, 255, 255, 0.6);
    --input-bg: rgba(248, 250, 252, 0.8);
    --shadow-color: rgba(0, 0, 0, 0.06);
    /* Much lighter shadow base */
    /* Legacy glass vars preserved */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    /* Soft diffuse shadow */
    --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.08), 0 10px 20px -5px rgba(0, 0, 0, 0.04);
}

/* Dark Mode */
body.dark-mode {
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --bg-gradient: radial-gradient(circle at top right, #0f172a, #1e293b 40%, #020617);
    --card-bg: rgba(30, 41, 59, 0.95);
    --card-border: rgba(255, 255, 255, 0.1);
    --input-bg: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
    /* Dark mode shadow needs to be stronger to be seen */
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: var(--text-main);
}

body.dark-mode .question-text {
    color: #f1f5f9;
}

body.dark-mode .option-pill {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .option-pill:hover {
    background: #334155;
}

body.dark-mode .label-main {
    color: #f1f5f9;
}

body.dark-mode .input-text,
body.dark-mode .input-textarea {
    color: #f1f5f9;
    background: var(--input-bg);
    border-color: #475569;
}

/* Admin Dark Mode Fixes */
body.dark-mode .admin-table th {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

body.dark-mode .admin-table td {
    color: #cbd5e1;
    border-color: #334155;
}

body.dark-mode .response-meta {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .meta-item div {
    color: #f1f5f9;
}

body.dark-mode .question-item {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .q-text {
    color: #f1f5f9;
}

body.dark-mode .q-answer {
    color: #cbd5e1;
    border-color: #334155;
}

body.dark-mode .badge {
    background: #334155;
    color: #f1f5f9;
}

body.dark-mode .question-text {
    color: #f1f5f9;
}

body.dark-mode .option-pill {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .option-pill:hover {
    background: #334155;
}

body.dark-mode .label-main {
    color: #f1f5f9;
}

body.dark-mode .input-text,
body.dark-mode .input-textarea {
    color: #f1f5f9;
    background: var(--input-bg);
    border-color: #475569;
}

/* Toggle */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow-color);
    display: grid;
    place-items: center;
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    transition: transform 0.5s ease;
}

.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

body.dark-mode .sun-icon {
    display: block;
}

body.dark-mode .moon-icon {
    display: none;
}

.page-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-gradient);
}

.top-bar {
    background: transparent;
    position: relative;
    z-index: 50;
}

.header-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
}

.logo-img {
    object-fit: contain;
    transition: transform 0.3s ease;
}

.tangram-logo {
    height: 70px;
    width: auto;
}

.gymkhana-logo {
    height: 90px;
    width: auto;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 30px 20px;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    /* Increased blur */
    border-radius: 32px;
    /* More rounded */
    padding: 32px 40px;
    /* Reduced padding from 48px */
    width: 100%;
    max-width: 800px;
    box-shadow:
        0 0 0 1px var(--card-border),
        /* Inner border ring */
        var(--shadow-lg);
    /* Soft outer shadow */
    border: none;
    /* Handled by box-shadow ring */
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.admin-card {
    max-width: 95%;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.8),
        0 30px 60px -10px rgba(0, 0, 0, 0.12);
    /* Softer float */
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.section-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--primary);
    margin-bottom: 16px;
    display: block;
    opacity: 0.9;
}

.question-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--text-main);
    line-height: 1.25;
    letter-spacing: -0.02em;
}

/* Form Elements */
.question-form {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.input-textarea {
    width: 100%;
    min-height: 160px;
    border-radius: 20px;
    border: 2px solid #e2e8f0;
    padding: 20px;
    font-size: 1.1rem;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--input-bg);
    resize: vertical;
    color: var(--text-main);
}

.input-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
    transform: translateY(-1px);
}

/* Options */
.options-wrap {
    position: relative;
    /* overflow: hidden; Removed to prevent clipping */
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px;
    /* Added padding to prevent shadow clipping */
    margin: -4px;
    /* Negative margin to offset padding */
}

.option-pill {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    border: 2px solid #f1f5f9;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--card-bg);
    margin-bottom: 0;
    position: relative;
}

.option-pill:hover {
    border-color: #cbd5e1;
    background: var(--bg-gradient);
    transform: translateX(4px);
}

.option-pill:has(input:checked) {
    border-color: var(--primary);
    background: #eef2ff;
    box-shadow: 0 8px 20px -4px rgba(79, 70, 229, 0.15);
    transform: translateX(4px);
}

body.dark-mode .option-pill:has(input:checked) {
    background: #172554;
    border-color: var(--primary);
}

.option-pill input[type="radio"],
.option-pill input[type="checkbox"] {
    appearance: none;
    width: 26px;
    height: 26px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    /* Circle for radio */
    display: grid;
    place-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    background-color: #fff;
}

.option-pill input[type="checkbox"] {
    border-radius: 8px;
    /* Square for checkbox */
}

.option-pill input[type="radio"]::before,
.option-pill input[type="checkbox"]::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: scale(0);
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: inset 1em 1em var(--primary);
    background-color: var(--primary);
    /* Fallback */
}

.option-pill input[type="checkbox"]::before {
    border-radius: 3px;
}

.option-pill input:checked {
    border-color: var(--primary);
}

.option-pill input:checked::before {
    transform: scale(1);
}

.label-main {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-main);
}

.option-other {
    flex-wrap: wrap;
}

.input-other {
    flex: 1;
    min-width: 200px;
    border: none;
    border-bottom: 2px solid #cbd5e1;
    padding: 8px 0;
    font-size: 1.1rem;
    font-family: inherit;
    background: transparent;
    transition: border-color 0.2s;
    margin-left: 8px;
    color: var(--text-main);
}

.input-other:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.nav-row {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid #f1f5f9;
}

.btn {
    padding: 14px 36px;
    border-radius: 10px;
    /* Slightly squarer for professional look */
    border: 2px solid transparent;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Updated Solid Primary Button */
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Inverse Hover Effect */
.btn-primary:hover {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

/* Button Variants */
.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Footer */
.footer {
    padding: 24px;
    text-align: center;
    font-size: 0.85rem;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.5);
}

.admin-actions {
    display: flex;
    gap: 12px;
}

.admin-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    font-size: 0.95rem;
}

.admin-table th {
    background: #f8fafc;
    text-align: left;
    padding: 16px;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
}

.admin-table td {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table details summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
}

.admin-table details pre {
    font-size: 0.8rem;
    background: #f1f5f9;
    padding: 12px;
    border-radius: 8px;
    margin-top: 8px;
    white-space: pre-wrap;
    color: #1e293b;
}

/* Admin & Response Styles */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-header .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-header .question-text {
    margin-bottom: 0;
    font-size: 1.75rem;
}

.response-meta {
    background: #f8fafc;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 40px;
    border: 1px solid #e2e8f0;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.meta-item label {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-item div {
    font-weight: 600;
    color: #0f172a;
    font-size: 1.1rem;
}

.section-block {
    margin-bottom: 48px;
}

.section-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.4rem;
    color: var(--primary);
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 12px;
    margin-bottom: 24px;
    font-weight: 700;
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.question-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.question-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.q-header {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.q-id {
    font-weight: 700;
    color: #94a3b8;
    min-width: 40px;
    font-size: 0.95rem;
}

.q-text {
    font-weight: 600;
    color: #1e293b;
    font-size: 1.05rem;
    line-height: 1.4;
}

.q-answer {
    margin-left: 56px;
    padding-top: 12px;
    border-top: 1px dashed #f1f5f9;
    color: #334155;
    font-size: 1rem;
    line-height: 1.5;
}

.q-answer ul {
    margin: 0;
    padding-left: 20px;
}

.q-answer li {
    margin-bottom: 4px;
}

.badge {
    background: #e2e8f0;
    color: #475569;
    padding: 6px 16px;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Responsiveness */
@media (max-width: 768px) {
    .header-container {
        padding: 12px 16px;
    }

    .tangram-logo {
        height: 50px;
    }

    .gymkhana-logo {
        height: 80px;
    }

    .main-content {
        padding: 30px 16px;
    }

    .card {
        padding: 24px;
        border-radius: 24px;
    }

    .question-text {
        font-size: 1.35rem;
        margin-bottom: 24px;
    }

    .btn {
        padding: 12px 24px;
        font-size: 0.95rem;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-header .header-left {
        width: 100%;
        justify-content: space-between;
    }

    .q-answer {
        margin-left: 0;
        margin-top: 12px;
    }
}

/* Added Styles */
.input-text {
    width: 100%;
    height: 60px;
    border-radius: 14px;
    border: 2px solid transparent;
    /* Cleaner look */
    background: #fff;
    /* White background usually looks cleaner */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    padding: 0 20px;
    font-size: 1.1rem;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--input-bg);
    color: var(--text-main);
}

.input-text:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .input-text {
        height: 50px;
        font-size: 1rem;
    }

    .option-pill {
        padding: 14px 18px;
        gap: 12px;
    }

    .label-main {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 20px;
    }

    .question-text {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }

    .nav-row {
        flex-direction: column-reverse;
        gap: 12px;
    }

    .btn {
        width: 100%;
    }
}

/* Progress Bar */
.progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 4px;
}

.progress-text {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.progress-percent {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-container {
    width: 100%;
    background-color: #e2e8f0;
    border-radius: 99px;
    height: 10px;
    margin-bottom: 32px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.progress-bar {
    height: 100%;
    background-color: var(--primary);
    border-radius: 99px;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy effect */
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

/* Error Toast */
.error-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ef4444;
    color: white;
    padding: 12px 24px;
    border-radius: 99px;
    font-weight: 600;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Admin Dark Mode Fixes */
body.dark-mode .admin-table th {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

body.dark-mode .admin-table td {
    color: #cbd5e1;
    border-color: #334155;
}

body.dark-mode .response-meta {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .meta-item div {
    color: #f1f5f9;
}

body.dark-mode .question-item {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .q-text {
    color: #f1f5f9;
}

body.dark-mode .q-answer {
    color: #cbd5e1;
    border-color: #334155;
}

body.dark-mode .badge {
    background: #334155;
    color: #f1f5f9;
}