/* Importing Premium Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* Global Root Variables for Styling */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --accent-color: #a855f7;
    --glass-blur: 12px;
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(6, 182, 212, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Master Layout Grid */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header & Navigation */
.main-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section a {
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: var(--transition-fast);
}

.logo-section a:hover {
    opacity: 0.9;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-links .btn-login {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #fff;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.nav-links .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}

.user-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-main);
}

.user-badge .role {
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
    background: var(--accent-color);
}

.user-badge .role.role-admin {
    background: var(--danger-color);
}

/* Content Area */
.main-content {
    flex: 1;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

/* Glassmorphic Card Style */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-main);
    margin-bottom: 2rem;
}

.glass-card.interactive {
    transition: var(--transition-normal);
}

.glass-card.interactive:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* Buttons Styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: 600;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition-normal);
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    transform: translateY(-2px);
}

/* Home Landing Page grid styles */
.hero-section {
    text-align: center;
    padding: 3.5rem 1rem;
}

.hero-section h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero-section p {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 700px;
    margin: 0 auto 2rem auto;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.section-card {
    border-top: 4px solid var(--primary-color);
}

.section-card.gov {
    border-top-color: var(--accent-color);
}

.paper-list {
    list-style: none;
    margin-top: 1rem;
}

.paper-list li {
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.paper-list li:last-child {
    border-bottom: none;
}

.paper-list a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.paper-list a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

/* Login Page Styling */
.login-container {
    max-width: 450px;
    margin: 3rem auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Dashboard Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.stat-box h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-box .value {
    font-size: 2.2rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-main);
}

/* CBT Exam Portal Layout */
.exam-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    min-height: 75vh;
}

@media (max-width: 900px) {
    .exam-layout {
        grid-template-columns: 1fr;
    }
}

.exam-main {
    display: flex;
    flex-direction: column;
}

.question-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.question-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.question-text {
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 2rem;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.option-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.option-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}

.option-item.selected {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--primary-color);
}

.option-item input[type="radio"] {
    accent-color: var(--primary-color);
    transform: scale(1.2);
}

.option-label {
    font-weight: 600;
    color: var(--primary-color);
}

.exam-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Sidebar CBT Navigation Panel */
.exam-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.timer-box {
    text-align: center;
    padding: 1.2rem;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.03);
}

.timer-box.warning {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
    animation: pulse 1s infinite alternate;
}

.timer-box h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.timer-box .time {
    font-size: 2rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--warning-color);
}

.timer-box.warning .time {
    color: var(--danger-color);
}

.questions-grid-container {
    flex: 1;
}

.q-status-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    font-size: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.q-dot {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    border: 1px solid var(--border-color);
}

/* TCS iON Specific Color Palettes */
.q-dot.not-visited {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.q-dot.not-answered {
    background: var(--danger-color);
    color: #fff;
    border-color: transparent;
}

.q-dot.answered {
    background: var(--success-color);
    color: #fff;
    border-color: transparent;
}

.q-dot.marked {
    background: var(--accent-color);
    color: #fff;
    border-color: transparent;
}

.q-dot.marked-answered {
    background: var(--info-color);
    color: #fff;
    border-color: transparent;
}

.grid-numbers {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.3rem;
}

.grid-numbers .btn-q-select {
    height: 38px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 700;
    transition: var(--transition-fast);
}

.grid-numbers .btn-q-select:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.grid-numbers .btn-q-select.active {
    box-shadow: 0 0 0 3px var(--primary-color);
}

/* Result Circular Gauge */
.result-gauge-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.result-circle {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: conic-gradient(var(--success-color) var(--score-angle, 0deg), rgba(255, 255, 255, 0.05) 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-circle::before {
    content: '';
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--bg-secondary);
}

.result-circle-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.result-circle-content .score {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--text-main);
    line-height: 1;
}

.result-circle-content .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Review Sheet Styles */
.review-sheet-q {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
}

.review-sheet-q:last-child {
    border-bottom: none;
}

.review-options {
    margin: 0.8rem 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

@media (max-width: 600px) {
    .review-options {
        grid-template-columns: 1fr;
    }
}

.review-opt-val {
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
}

.review-opt-val.correct-ans {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
    color: var(--success-color);
    font-weight: 600;
}

.review-opt-val.user-ans {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger-color);
}

.review-opt-val.user-ans.correct-ans {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
    color: var(--success-color);
}

/* Admin Dashboard Tables & Tabs */
.tab-container {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    gap: 1rem;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 2px solid transparent;
}

.tab-btn:hover, .tab-btn.active {
    color: var(--text-main);
}

.tab-btn.active {
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

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

.admin-table th {
    background: rgba(255, 255, 255, 0.03);
    font-family: var(--font-heading);
    color: var(--text-muted);
    font-weight: 600;
}

.admin-table td {
    font-size: 0.9rem;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Upload styling */
.file-upload-zone {
    border: 2px dashed rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.02);
    border-radius: 12px;
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
}

.file-upload-zone:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.file-upload-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Footer Styling */
.main-footer {
    border-top: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.9);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Animation utilities */
@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.02); }
}

/* Utility classes */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 { gap: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.text-center { text-align: center; }

.badge-green { background: rgba(16, 185, 129, 0.15); color: var(--success-color); padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.badge-red { background: rgba(239, 68, 68, 0.15); color: var(--danger-color); padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.badge-orange { background: rgba(245, 158, 11, 0.15); color: var(--warning-color); padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }

/* Light Theme Styling Overrides */
:root.light-theme, html.light-theme, body.light-theme, .light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.7);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary-color: #4f46e5;
    --primary-hover: #3730a3;
    --accent-color: #8b5cf6;
    --shadow-main: 0 8px 32px 0 rgba(148, 163, 184, 0.12);
}

body.light-theme, .light-theme body {
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.06) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(6, 182, 212, 0.03) 0px, transparent 50%);
}

body.light-theme .main-header, .light-theme .main-header {
    background: rgba(255, 255, 255, 0.8);
}

body.light-theme .main-footer, .light-theme .main-footer {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

body.light-theme .form-control, .light-theme .form-control {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-main);
}

body.light-theme .stat-box, .light-theme .stat-box {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme .paper-list li, .light-theme .paper-list li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme .nav-links a:hover, body.light-theme .nav-links a.active, .light-theme .nav-links a:hover, .light-theme .nav-links a.active {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .btn-secondary, .light-theme .btn-secondary {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-main);
}

body.light-theme .btn-secondary:hover, .light-theme .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.light-theme .admin-table th, .light-theme .admin-table th {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-muted);
}

body.light-theme .admin-table tr:hover td, .light-theme .admin-table tr:hover td {
    background: rgba(0, 0, 0, 0.01);
}

body.light-theme .flex-between, .light-theme .flex-between {
    background: rgba(0, 0, 0, 0.01) !important;
    border-color: rgba(0, 0, 0, 0.04) !important;
}

