/* styles.css - Auditing Theme */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    /* Changed to Professional Blue/Navy Theme */
    --primary: #0056b3;      /* Royal Blue */
    --secondary: #17a2b8;    /* Cyan/Info */
    --accent: #ffc107;       /* Warning/Audit Note Yellow */
    --dark: #1e293b;         /* Slate Dark */
    --light: #f8f9fa;        /* Off White */
    --success: #198754;      /* Success Green */
    --danger: #dc3545;       /* Error Red */
    
    --glass: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(0, 86, 179, 0.2);
    --shadow: 0 8px 32px 0 rgba(30, 41, 59, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    /* Blue Gradient Background */
    background: linear-gradient(135deg, #0f172a, #0056b3, #17a2b8);
    background-size: 400% 400%;
    background-attachment: fixed;
    animation: gradientBG 15s ease infinite;
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    width: 100%;
    max-width: 850px;
    margin: 2rem 1rem;
    background: var(--glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px); /* Safari support */
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- Header --- */
header {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 86, 179, 0.05);
    border-bottom: 1px solid rgba(0, 86, 179, 0.1);
}

h1 { font-weight: 700; color: var(--primary); font-size: 2.2rem; margin-bottom: 0.5rem; }
h2 { color: var(--dark); margin-bottom: 1rem; }
p { color: #666; }

/* --- Inputs & Buttons --- */
.control-panel {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.number-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 0.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

/* Input Box Fix */
input[type="number"] {
    width: 80px;
    text-align: center;
    border: 2px solid #cbd5e1;
    background: white;
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    font-family: 'Poppins', sans-serif;
    margin: 0 10px;
    -moz-appearance: textfield;
}
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}

input[type="number"]:focus { outline: none; border-color: var(--primary); }

.circle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circle-btn:hover { transform: scale(1.1); }

.btn {
    padding: 0.8rem 2rem;
    border-radius: 50px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(to right, var(--primary), #2563eb);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 86, 179, 0.3);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 86, 179, 0.4); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover { background: var(--primary); color: white; }

/* --- Quiz UI --- */
.quiz-header-info {
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    font-weight: 600;
    background: rgba(0, 86, 179, 0.05);
}

.progress-container {
    height: 6px;
    background: #e2e8f0;
    width: 100%;
}

.progress-bar {
    height: 100%;
    background: var(--secondary);
    width: 0%;
    transition: width 0.4s ease;
}

.question-card {
    padding: 2rem;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--dark);
}

.options-grid {
    display: grid;
    gap: 1rem;
}

.option {
    padding: 1rem 1.5rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    font-weight: 500;
    color: #475569;
}

.option:hover { border-color: var(--primary); background: #f0f9ff; }

.option.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(0, 86, 179, 0.3);
}

.option-badge {
    background: rgba(0,0,0,0.1);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 15px;
    font-size: 0.9rem;
}

/* --- Results Dashboard --- */
.results-dashboard {
    padding: 2rem;
    text-align: center;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--success) var(--percent, 0%), #e2e8f0 0);
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 130px;
    height: 130px;
    background: white;
    border-radius: 50%;
}

.score-text {
    position: relative;
    z-index: 1;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #f1f5f9;
}

.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.9rem; color: #64748b; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* --- Review Section --- */
.review-item {
    background: white;
    margin-bottom: 1rem;
    border-radius: 12px;
    overflow: hidden;
    border-left: 5px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.review-item.correct { border-left-color: var(--success); }
.review-item.incorrect { border-left-color: var(--danger); }
.review-item.skipped { border-left-color: #f59e0b; }

.review-header {
    padding: 1rem;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    border-bottom: 1px solid #f1f5f9;
}

.review-body { padding: 1rem; }

.ans-row {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
}

.ans-row.your-ans { background: #fef2f2; color: var(--danger); }
.ans-row.your-ans.correct { background: #f0fdf4; color: var(--success); }
.ans-row.correct-ans { background: #f0fdf4; color: var(--success); font-weight: 600; }

/* --- Floating Home Button --- */
.floating-home-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.floating-home-btn:hover {
    transform: scale(1.15) rotate(-10deg);
    background: linear-gradient(135deg, var(--secondary), #0ea5e9);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .container { 
        margin: 0; 
        border-radius: 0; 
        min-height: 100vh; 
        border: none; 
        max-width: 100%;
    }

    header {
        padding: 1rem 0.5rem; 
    }
    
    h1 { 
        font-size: 1.5rem;
        line-height: 1.2;
        margin-bottom: 0.25rem;
    }
    
    header p {
        font-size: 0.85rem;
    }

    /* Fix quiz header */
    .quiz-header-info {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .quiz-header-info span {
        font-size: 0.9rem;
    }
    
    #timer {
        font-size: 0.85rem;
    }

    /* Reduce question card padding */
    .question-card {
        padding: 1rem;
        max-height: calc(100vh - 250px);
        overflow-y: auto;
    }
    
    .question-text {
        font-size: 1.1rem;
        margin-bottom: 1.2rem;
        line-height: 1.4;
    }
    
    /* Optimize options grid */
    .options-grid {
        gap: 0.75rem;
    }
    
    .option {
        padding: 0.8rem 1rem;
        min-height: 60px;
    }
    
    .option-badge {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
        margin-right: 10px;
        flex-shrink: 0;
    }
    
    /* Fix button container */
    .question-card + div {
        padding: 1rem !important;
        position: sticky;
        bottom: 0;
        background: var(--glass);
        border-top: 1px solid #eee;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* Button adjustments */
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        flex: 1;
        min-width: 100px;
        text-align: center;
    }
    
    #submitBtn {
        order: -1;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Progress indicator */
    #currentQNum, #totalQNum {
        font-weight: bold;
    }
    
    #subjectTag {
        float: none;
        display: inline-block;
        margin-top: 0.25rem;
        font-size: 0.75rem;
        padding: 2px 6px;
    }
    
    /* Results screen fixes */
    .stats-grid { 
        grid-template-columns: 1fr; 
        gap: 0.75rem;
        margin: 1.5rem 0;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
        margin: 1rem auto;
    }
    
    .score-circle::before {
        width: 100px;
        height: 100px;
    }
    
    .score-text {
        font-size: 2rem;
    }
    
    .results-dashboard {
        padding: 1.5rem 1rem;
    }
    
    /* Review screen fixes */
    #reviewContainer {
        padding: 1rem 0.5rem;
        max-height: calc(100vh - 180px);
    }
    
    .review-header {
        padding: 0.75rem;
        font-size: 0.9rem;
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }
    
    .review-body {
        padding: 0.75rem;
    }
    
    .ans-row {
        flex-direction: column;
        gap: 0.25rem;
        font-size: 0.85rem;
    }
    
    /* Floating button position */
    .floating-home-btn {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        font-size: 1.5rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        opacity: 0.9;
    }
}

/* Add this for very small screens */
@media (max-width: 400px) {
    .question-card {
        padding: 0.75rem;
        max-height: calc(100vh - 220px);
    }
    
    .question-text {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .option {
        padding: 0.7rem 0.8rem;
        min-height: 55px;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        min-width: 85px;
    }
    
    .quiz-header-info {
        font-size: 0.8rem;
    }
}

.screen { display: none; animation: fadeIn 0.4s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }