/* General Styles */
:root {
    --primary-color: #FFC0CB; /* Pastel Pink */
    --secondary-color: #FFB6C1; /* Lighter Pink */
    --accent-color: #FF69B4; /* Hot Pink for accents */
    --text-color: #5D5D5D;
    --bg-color: #FFF5F7; /* Very light pink background */
    --white-color: #FFFFFF;
    --border-radius: 12px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    width: 100%;
    background: var(--white-color);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 50px;
}

.hero h1 {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.hero .subtitle {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 20px;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.btn-start {
    background-color: var(--accent-color);
    color: var(--white-color);
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 4px 10px rgba(255, 105, 180, 0.4);
}

.btn-start:hover {
    background-color: #FF85C1;
    transform: translateY(-3px);
}

/* Details & About Sections */
.details-section, .about-section {
    margin-bottom: 40px;
}

h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--text-color);
    padding-bottom: 10px;
    display: inline-block;
}

section {
    text-align: center;
}

.features {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    text-align: center;
}

.feature-item {
    background: var(--bg-color);
    padding: 20px;
    border-radius: var(--border-radius);
    flex: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow);
}

.feature-item h3 {
    color: var(--accent-color);
    margin-bottom: 10px;
}

.about-section p {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--secondary-color);
}

.admin-login-btn {
    display: inline-block;
    margin-top: 10px;
    text-decoration: none;
    color: var(--text-color);
    background: #f0f0f0;
    padding: 8px 15px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.admin-login-btn:hover {
    background: #e0e0e0;
}

/* --- MODAL STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.modal {
    background: var(--white-color);
    padding: 30px 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    width: 90%;
    max-width: 500px;
    transform: scale(0.9);
    animation: scaleIn 0.3s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes scaleIn {
    to { transform: scale(1); }
}

.modal h2 {
    margin-bottom: 25px;
    border: none;
}

.question-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.modal .option-btn {
    background: var(--bg-color);
    border: 2px solid var(--primary-color);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal .option-btn:hover {
    background: var(--secondary-color);
}

.modal .option-btn.selected {
    background: var(--accent-color);
    color: var(--white-color);
    border-color: var(--accent-color);
}

.custom-option input {
    width: 100px;
    padding: 10px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
}

.btn-start-quiz {
    background-color: var(--accent-color);
    color: var(--white-color);
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 80%;
}

.btn-start-quiz:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.btn-start-quiz:not(:disabled):hover {
    background-color: #FF85C1;
    transform: translateY(-2px);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #aaaaaa;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: #333333;
}

/* --- QUIZ PAGE STYLES --- */
.quiz-container {
    max-width: 800px;
}

.quiz-header {
    text-align: center;
    margin-bottom: 30px;
}

.quiz-header h1 {
    margin-bottom: 10px;
}

#question-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 30px;
    min-height: 80px;
}

#options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

#options-container .option-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    text-align: left;
    background: #fdf2f4;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

#options-container .option-btn:not(:disabled):hover {
    background: var(--secondary-color);
    border-color: var(--accent-color);
}

#options-container .option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

#options-container .option-btn.correct {
    background-color: #D4EDDA; /* Green */
    border-color: #C3E6CB;
    color: #155724;
    font-weight: bold;
}

#options-container .option-btn.incorrect {
    background-color: #F8D7DA; /* Red */
    border-color: #F5C6CB;
    color: #721C24;
}

.quiz-footer {
    text-align: right;
    margin-top: 20px;
}

#next-btn {
    display: none; /* Initially hidden */
}

/* --- Feedback Styles --- */
#feedback-container {
    margin-top: 20px;
    font-size: 1.1rem;
}

.feedback {
    padding: 20px; /* Increased space around the words */
    border-radius: var(--border-radius); /* Use the standard rounded corners */
}

.feedback.correct {
    background-color: #D4EDDA;
    color: #155724;
}

.feedback.incorrect {
    background-color: #F8D7DA;
    color: #721C24;
}

.feedback strong {
    font-weight: 700;
}

/* --- RESULTS PAGE STYLES --- */
.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--white-color);
    background-color: #ccc; /* Default color */
}

.score-circle.green { background-color: #28a745; }
.score-circle.yellow { background-color: #ffc107; }
.score-circle.red { background-color: #dc3545; }

#score-details {
    font-size: 1.2rem;
    font-weight: 600;
}

.results-summary h2 {
    border: none;
    text-align: left;
    margin-bottom: 20px;
}

.review-item {
    background-color: var(--bg-color);
    border: 1px solid var(--secondary-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
}

.review-question strong {
    color: var(--accent-color);
}

.review-answers {
    margin-top: 15px;
    padding-left: 10px;
    border-left: 3px solid var(--primary-color);
}

.user-answer.correct { color: #155724; }
.user-answer.incorrect { color: #721C24; }
.correct-answer { color: #155724; font-weight: 600; }

.results-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

.btn-secondary {
    background-color: var(--white-color);
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: var(--accent-color);
    color: var(--white-color);
}

/* --- ADMIN PAGE STYLES --- */
.admin-container {
    max-width: 500px;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-form h1 {
    text-align: center;
    border: none;
    padding: 0;
}

.admin-form p {
    text-align: center;
    margin: -10px 0 0;
}

.admin-form input {
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
}

.admin-form button {
    background-color: var(--accent-color);
    color: var(--white-color);
    border: none;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.admin-form button:hover {
    background-color: #FF85C1;
}

.error-message {
    color: #721C24;
    text-align: center;
    min-height: 20px;
}

/* --- DASHBOARD STYLES --- */
.dashboard-container {
    max-width: 1100px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
}

.dashboard-header h1 {
    border: none;
    margin: 0;
    padding: 0;
}

/* --- Dashboard Management Section Styles --- */
.management-section {
    background-color: var(--bg-color);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    border: 1px solid var(--secondary-color);
}

.management-section h2 {
    text-align: left;
    border: none;
    padding: 0;
    margin-bottom: 20px;
}

.feedback-message {
    text-align: center;
    min-height: 20px;
    font-weight: 600;
    margin-top: 10px;
}

.feedback-message.success {
    color: #155724; /* Green */
}

.feedback-message.error {
    color: #721C24; /* Red */
}

/* --- Admin Data Table Styles --- */
.table-container {
    margin-top: 30px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    border: 1px solid var(--secondary-color);
    text-align: left;
}

.data-table thead {
    background-color: var(--bg-color);
}

.data-table th {
    font-weight: 600;
}

.data-table .actions {
    text-align: center;
    white-space: nowrap;
}

.actions button {
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin: 0 5px;
    font-weight: 600;
}

.btn-edit {
    background-color: #ffc107; /* Yellow */
    color: #333;
}

.btn-delete {
    background-color: #dc3545; /* Red */
    color: white;
}

/* --- Question Form Styles --- */
#question-form label {
    font-weight: 600;
    margin-top: 10px;
    margin-bottom: -10px;
}

#question-form select, #question-form input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border-radius: var(--border-radius);
    border: 2px solid var(--primary-color);
}

.option-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.option-input-wrapper input {
    flex-grow: 1;
}

.remove-option-btn {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
}

#question-form .btn-secondary {
    align-self: flex-start;
}

.table-container h3 {
    margin-top: 40px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* --- Styles for Multiple Choice Admin --- */
.correct-answer-checkbox {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* --- Styles for Multiple Choice Quiz Player --- */
.option-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    font-size: 1.1rem;
    background: #fdf2f4;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 10px;
}
.option-checkbox-wrapper:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.7;
}
.option-checkbox-wrapper:has(input:not(:disabled)):hover {
    background: var(--secondary-color);
    border-color: var(--accent-color);
}
.option-checkbox-wrapper input {
    width: 20px;
    height: 20px;
}
.option-checkbox-wrapper label {
    flex-grow: 1;
    cursor: pointer;
}

/* --- Styles for Drag & Drop Admin --- */
.drag-drop-pair-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.drag-drop-pair-wrapper input {
    flex-grow: 1;
}
.drag-drop-pair-wrapper span {
    font-size: 1.5rem;
}

/* --- Styles for Drag & Drop Quiz Player --- */
.drag-drop-container {
    display: flex;
    justify-content: space-between;
    gap: 30px;
}
.draggables, .targets {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.draggable {
    background-color: var(--white-color);
    border: 2px dashed var(--accent-color);
    padding: 15px;
    border-radius: var(--border-radius);
    cursor: grab;
    text-align: center;
}
.target {
    background-color: var(--bg-color);
    border: 2px solid var(--primary-color);
    min-height: 70px;
    padding: 10px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.target .draggable {
    cursor: default;
    border-style: solid;
    width: 50%;
}
.target .target-label {
    flex-grow: 1;
    text-align: center;
    padding-right: 10px;
}

/* --- SURGICAL REPLACEMENT for Admin Question Editor UI --- */
/* This uses CSS Grid for a robust, predictable layout. */

.quiz-editor-option-row {
  display: grid;
  grid-template-columns: 40px 1fr 40px; /* Checkbox | Text Input (fills space) | Delete Button */
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.quiz-editor-option-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-editor-option-text {
  justify-content: flex-start;
}

.quiz-editor-option-row input[type="text"] {
  width: 100%;
  box-sizing: border-box; /* Ensures padding doesn't break layout */
}

.quiz-editor-option-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

/* --- Final Polish for Admin Form Elements --- */

/* Style for labels in the admin forms */
.admin-form label {
    font-weight: 600;
    margin-bottom: -10px; /* Aligns with input field spacing */
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Style for all select dropdowns to match the theme */
.admin-form select {
    appearance: none; /* Remove default browser styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--white-color);
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    width: 100%;
    cursor: pointer;
    color: var(--text-color);
    font-family: 'Poppins', sans-serif;
    
    /* Custom dropdown arrow using an SVG */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23FF69B4' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 1em;
}

.admin-form select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 5px var(--secondary-color);
}

/* --- Final Polish for Homepage Feature Icons --- */

.feature-icon {
    margin-bottom: 15px;
    color: var(--accent-color); /* This sets the color for the SVG stroke */
}

.feature-icon svg {
    width: 48px;
    height: 48px;
}

.feature-item h3 {
    margin-top: 0; /* Adjust spacing now that icon is present */
}

/* --- Phase 9: Admin Dashboard Layout Revamp --- */

body.dashboard-body {
    /* Override centered body for dashboard to allow full-width layout */
    display: block;
    padding: 0;
    min-height: 100vh;
    background-color: var(--white-color); /* Set a base bg for the whole page */
}

.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.dashboard-nav {
    width: 260px;
    background-color: var(--bg-color);
    border-right: 1px solid var(--secondary-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0;
}

.dashboard-nav .nav-header h2 {
    color: var(--accent-color);
    text-align: left;
    border: none;
    padding: 0;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.dashboard-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.dashboard-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dashboard-nav .nav-link:hover {
    background-color: var(--secondary-color);
}

.dashboard-nav .nav-link.active {
    background-color: var(--accent-color);
    color: var(--white-color);
}

.dashboard-nav .nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.dashboard-nav .nav-footer {
    margin-top: auto;
}

.dashboard-nav .nav-footer #logout-btn {
    width: 100%;
}

.dashboard-main {
    flex-grow: 1;
    padding: 40px;
    background-color: var(--white-color);
    overflow-y: auto;
}

/* Toggling logic for sections */
.management-section {
    display: none; /* Hide all sections by default */
}

.management-section.active {
    display: block; /* Show only the active section */
}

/* --- Phase 10: Bulk Upload UI Styles --- */
#upload-section .instructions {
    background-color: var(--bg-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    border: 1px solid var(--secondary-color);
}
#upload-section .instructions h4 {
    margin-top: 0;
    font-size: 1.2rem;
    color: var(--accent-color);
}
#upload-section .instructions ul {
    margin-left: 20px;
    margin-bottom: 20px;
}
#upload-section .instructions li {
    margin-bottom: 5px;
}

#drop-zone {
    border: 3px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 50px;
    text-align: center;
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

#drop-zone:hover,
#drop-zone.dragover {
    background-color: var(--bg-color);
    border-color: var(--accent-color);
}

#upload-feedback {
    margin-top: 20px;
}
