/* --- General and Responsive Setup --- */
:root {
    --primary-bg: #1e1e1e;
    --secondary-bg: #2c2c2c;
    --text-light: #f0f2f5;
    --text-dark: #1e1e1e;
    --accent-green: #4CAF50;
    --accent-red: #F44336;
    --accent-blue: #007bff;
    --accent-yellow: #ffc107;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--primary-bg);
}

.phone-wrapper {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}


.phone-container {
    width: 100%;
    height: 100%;
    background-color: var(--primary-bg);
    display: flex;
    flex-direction: column;
    color: var(--text-light);
    overflow: hidden;
}


.content-area {
    position: relative;
    flex-grow: 1;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

.header {
    background-color: rgb(4, 0, 250);
    color: rgb(30, 255, 0);
    border: 2px solid yellow;
    border-radius: 25px;
    padding: 15px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    flex-shrink: 0;
}

.content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    color: var(--accent-yellow);
}
.content::-webkit-scrollbar { width: 5px; }
.content::-webkit-scrollbar-track { background: var(--primary-bg); }
.content::-webkit-scrollbar-thumb { background: #555; border-radius: 5px; }


/* --- Top Header Bar --- */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #111;
    flex-shrink: 0;
}
.header-left, .header-right { display: flex; align-items: center; gap: 15px; }
.logo { height: 30px; border-radius: 25px;}
.menu-btn { font-size: 1.5em; cursor: pointer; color: var(--text-light); }
.user-auth .auth-btn {
    background: var(--accent-red);
    color: rgb(252, 235, 4);
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}
.user-auth .profile-icon {
    font-size: 1.8em;
    color: rgb(0, 255, 42);
    cursor: pointer;
}

#google_translate_element { color: #08b7ec; background: #f70505; padding: 2px 5px; border-radius: 25px; border: 2px solid #05fd75 !important; }
.goog-te-combo { background-color: #fa0202 !important; color: rgb(28, 3, 253) !important; border: 2px solid #05fd75 !important; border-radius: 3px !important; padding: 5px !important; }
.goog-te-gadget-simple { background-color: transparent !important; border: none !important; }
.goog-te-gadget-icon { display: none !important; }


/* --- Side Navigation Menu --- */
.side-nav {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1001;
    top: 0;
    left: 0;
    background-color: #f6fa02;
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 60px;
}
.side-nav a {
    padding: 10px 15px;
    text-decoration: none;
    font-size: 1.2em;
    color: #fa0505;
    border: 2px solid #05fd75 !important;
    display: block;
    transition: 0.3s;
}
.side-nav a:hover { color: #4401fa; }
.side-nav .close-btn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
}


/* --- Main Menu --- */
.daily-challenge-section { margin-bottom: 25px; }
.daily-challenge-section h4 { margin: 0 0 10px 0; color: var(--accent-yellow); }
.challenge-card { display: flex; align-items: center; justify-content: space-between; background-color: var(--secondary-bg); padding: 15px; border-radius: 8px; border-left: 5px solid var(--accent-blue); cursor: pointer; }
.challenge-info h5 { margin: 0 0 5px 0; color: var(--text-light); }
.challenge-info p { margin: 0; font-size: 0.9em; color: #ccc; }
.challenge-icon i { font-size: 2.5em; color: var(--accent-blue); }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; text-align: center; }
.menu-item { cursor: pointer; transition: transform 0.2s; }
.menu-item:hover { transform: scale(1.05); }
.menu-item .icon-container { background-color: white; border: 3px solid #fd0543 !important; border-radius: 50%; width: 90px; height: 90px; margin: 0 auto; display: flex; justify-content: center; align-items: center; box-shadow: 0 2px 8px rgb(60, 253, 1); padding: 15px; box-sizing: border-box; }
.menu-item .icon-container img { max-width: 100%; max-height: 100%; }
.menu-item p { margin-top: 10px; font-size: 1em; color: #05f725;}

/* --- Topic, Chapter, Level & Generic List --- */
.topic-list, .chapter-list, .level-list, .list-container { list-style: none; padding: 0; margin: 0; }
.topic-item, .chapter-item, .level-item, .list-item { background-color: var(--secondary-bg); border-radius: 0px 20px 0px 20px; border: 2px solid red; padding: 10px 15px; margin-bottom: 10px; display: flex; align-items: center; cursor: pointer; transition: background-color 0.3s; }
.topic-item:hover, .chapter-item:hover, .level-item:hover, .list-item:hover { background-color: #3e3e3e; }
.topic-item-icon, .chapter-item-icon, .list-item-icon { border-radius: 50%; width: 40px; height: 40px; margin-right: 15px; border: 2px solid rgb(72, 255, 0); background-color: white; padding: 5px; box-sizing: border-box; }
.level-item-icon { color: var(--accent-blue); font-size: 2em; margin-right: 15px; width: 40px; text-align: center; }
.topic-item-text, .chapter-item-text, .level-item-text, .list-item-text { flex-grow: 1; }
.topic-item-arrow, .chapter-item-arrow, .level-item-arrow, .list-item-arrow { font-size: 1.5em; }
.topic-item-pdf, .chapter-item-pdf { color: var(--accent-red); font-size: 1.5em; margin: 0 10px; cursor: pointer; }


/* --- Quiz & Review Screen --- */
#quiz-header-container { display: flex; justify-content: space-between; align-items: center; }
.quiz-top-icons { display: flex; }
.icon-wrapper { position: relative; }
.quiz-top-icons i { margin-left: 18px; cursor: pointer; transition: color 0.3s; font-size: 1.1em; }
.quiz-top-icons i:hover { color: var(--accent-blue); }

/* NEW: Quiz Info Bar */
#quiz-info-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; background-color: var(--secondary-bg); color: #ccc; font-size: 0.9em; flex-shrink: 0; }
.info-item { display: flex; align-items: center; gap: 5px; }
.info-item .fas { color: var(--accent-yellow); }
.info-item.timer { font-size: 1.2em; font-weight: bold; color: var(--text-light); }
.info-item.timer #reaction-emoji { font-size: 1.4em; margin-right: 5px; }
#answer-status-emoji { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); font-size: 8em; display: none; justify-content: center; align-items: center; z-index: 50; animation: fadeIn 0.3s; }

/* Dropdown Menu */
.dropdown-menu { display: none; position: absolute; right: 0; top: 30px; background-color: #3e3e3e; border-radius: 5px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); z-index: 100; width: 120px; overflow: hidden; }
.dropdown-menu a { color: var(--text-light); padding: 10px 15px; text-decoration: none; display: block; font-size: 0.9em; text-align: left; }
.dropdown-menu a:hover { background-color: #555; }


#quiz-progress, #review-progress { text-align: center; margin-bottom: 20px; font-size: 1.1em; font-weight: bold; }
#question-container, #review-question-container { color: var(--accent-red); background-color: var(--secondary-bg); border: 2px solid #043efc; border-radius: 25px; padding: 20px; margin-bottom: 20px; font-size: 1.1em; min-height: 80px; animation: fadeIn 0.5s ease; }
.options-container { display: flex; flex-direction: column; gap: 10px; }
.option-btn { background-color: #3e3e3e; color: rgb(45, 250, 4); border: 2px solid #08b7ec; border-radius: 8px; padding: 15px; width: 100%; text-align: left; font-size: 1em; cursor: pointer; transition: background-color 0.3s, border-color 0.3s; animation: fadeIn 0.5s ease forwards; opacity: 0; position: relative;}
.option-btn:nth-child(1) { animation-delay: 0.1s; }
.option-btn:nth-child(2) { animation-delay: 0.2s; }
.option-btn:nth-child(3) { animation-delay: 0.3s; }
.option-btn:nth-child(4) { animation-delay: 0.4s; }

.option-btn.correct { background-color: var(--accent-green); border-color: var(--accent-green); color: white; }
.option-btn.incorrect { background-color: var(--accent-red); border-color: var(--accent-red); color: white; }
.option-btn.user-choice::after { content: '✔ Your Answer'; position: absolute; right: 15px; top: 50%; transform: translateY(-50%); font-weight: bold; font-size: 0.8em; }

.option-btn:disabled { cursor: not-allowed; opacity: 0.9; }
#explanation-container, #review-explanation-container { background-color: var(--secondary-bg); color: greenyellow; border-radius: 40px 0px 40px 0px; border: 2px solid red; padding: 15px; margin-top: 20px; display: none; animation: fadeIn 0.5s ease; }
#explanation-container h3, #review-explanation-container h3 { margin-top: 0; }

.quiz-footer { display: flex; justify-content: space-between; padding: 10px; background-color: var(--secondary-bg); flex-shrink: 0; }
.footer-btn { background-color: fuchsia; border: 3px solid #f80404; color: var(--text-light); padding: 10px; border-radius: 5px; cursor: pointer; font-size: 0.9em; transition: background-color 0.3s, color 0.3s, border-color 0.3s; flex-grow: 1; margin: 0 5px; }
.footer-btn:hover { border-color: var(--accent-blue); color: yellow; }
.footer-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.footer-btn i { margin-right: 5px; }

/* --- Results Screen --- */
.score-summary { text-align: center; background-color: var(--secondary-bg); padding: 20px; border-radius: 8px; margin-bottom: 20px; }
.score-summary h3 { margin-top: 0; color: var(--accent-green); }
.rank-title { text-align: center; margin: 20px 0 15px 0; color: red;}
.rank-item { display: flex; align-items: center; background-color: var(--secondary-bg); padding: 10px; border-radius: 0px 20px 0px 20px; border: 2px solid red; margin-bottom: 8px; border: 2px solid #fdec05 !important;}
.rank-item.current-user { border: 2px solid var(--accent-green); }
.rank-position { font-size: 1.2em; font-weight: bold; width: 40px; color: #08b7ec;}
.rank-profile-icon { width: 40px; height: 40px; border-radius: 50%; margin-right: 15px; object-fit: cover; border: 2px solid #fd0505 !important;}
.rank-user-id { flex-grow: 1; color: #19fc04;}
.back-btn { display: block; width: 100%; margin-top: 10px; margin-bottom: 10px; padding: 15px; background-color: var(--accent-blue); border: 3px solid #05fd75 !important; border: none; color: rgb(249, 253, 4); border-radius: 20px 0px 20px 0px; font-size: 1em; cursor: pointer; }

/* Score Graph */
#score-graph-container { padding: 20px; background-color: var(--secondary-bg); border-radius: 8px; }
.graph-bar-item { display: flex; align-items: center; margin-bottom: 12px; }
.graph-label { width: 80px; font-size: 0.9em; }
.graph-bar-bg { flex-grow: 1; background-color: #3e3e3e; border-radius: 5px; height: 20px; overflow: hidden; }
.graph-bar { height: 100%; width: 0%; border-radius: 5px; transition: width 1s ease-out; text-align: right; padding-right: 8px; box-sizing: border-box; color: rgb(255, 255, 255); font-weight: bold; font-size: 0.8em; line-height: 20px; }
.bar-user { background-color: var(--accent-green); }
.bar-average { background-color: var(--accent-blue); }
.bar-topper { background-color: var(--accent-yellow); }


/* --- Bottom Navigation Bar --- */
.bottom-nav { display: flex; justify-content: space-around; background-color: var(--secondary-bg); padding: 8px 0; flex-shrink: 0; border-top: 2px solid #f7e705; border-bottom: 3px solid #05f725; }
.nav-item { display: flex; flex-direction: column; align-items: center; color: #ccc; text-decoration: none; font-size: 0.8em; cursor: pointer; transition: color 0.3s; width: 20%; text-align: center;}
.nav-item i { font-size: 1.5em; margin-bottom: 4px; }
.nav-item:hover, .nav-item.active { color: var(--accent-blue); }


/* --- Profile Screen --- */
.profile-card { background-color: var(--secondary-bg); border-radius: 12px; padding: 25px; text-align: center; margin-bottom: 25px; }
.avatar-wrapper { position: relative; width: 100px; height: 100px; margin: 0 auto 15px auto; }
.profile-avatar { width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--accent-blue); object-fit: cover; }
.upload-icon { position: absolute; bottom: 0; right: 0; background-color: var(--accent-blue); color: white; width: 30px; height: 30px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; border: 2px solid var(--primary-bg); }
#photo-upload { display: none; }

.profile-card h3 { margin: 0 0 5px 0; font-size: 1.4em; }
.profile-card p { margin: 5px 0; color: #ccc; }
.profile-card .last-login { font-size: 0.8em; color: #999; margin-top: 10px; }
#quiz-history-container .quiz-history-item { 
    display: grid; 
    grid-template-columns: 1fr auto; 
    grid-template-areas: "info score" "info actions"; 
    gap: 10px; 
    align-items: center; 
    background-color: var(--secondary-bg); 
    padding: 15px; 
    border-radius: 0px 20px 0px 20px; 
    border: 2px solid #05fd75 !important; 
    margin-bottom: 10px; 
}
.quiz-history-item .history-info { grid-area: info; }
.quiz-history-item .history-info .title { font-weight: bold; }
.quiz-history-item .history-info .date { font-size: 0.8em; color: #ccc; }
.quiz-history-item .history-score { grid-area: score; font-weight: bold; color: var(--accent-green); justify-self: end; }
.quiz-history-item .history-actions { grid-area: actions; display: flex; gap: 8px; justify-self: end;}
.history-btn { padding: 6px 10px; border: none; border-radius: 5px; cursor: pointer; font-size: 0.8em; color: white; }
.history-btn.restart { background-color: var(--accent-blue); }
.history-btn.result { background-color: var(--accent-green); }

/* NEW: Delete Button Styling */
.history-btn.delete {
    background-color: var(--accent-red);
    color: white;
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 0.9em;
    cursor: pointer;
    display: flex; /* For icon alignment */
    align-items: center;
    justify-content: center;
}
.history-btn.delete:hover {
    background-color: #d32f2f;
}
.history-btn.delete i {
    margin: 0; /* Remove margin-right from general icon style */
}

.logout-btn { display: block; width: 100%; margin-top: 30px; padding: 15px; background-color: var(--accent-red); border: none; color: rgb(9, 252, 62); border-radius: 20px 0px 20px 0px; border: 3px solid #051efd !important; font-size: 1.1em; cursor: pointer; text-align: center; }
.logout-btn i { margin-left: 8px; }

/* --- Modals --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.7); }
.modal-content { background-color: var(--secondary-bg); margin: 15% auto; padding: 25px; border: 3px solid #f80808; width: 90%; max-width: 400px; border-radius: 0px 20px 0px 20px; position: relative; animation: fadeIn 0.3s; }
.close-modal-btn { color: #062bfc; position: absolute; top: 10px; right: 20px; font-size: 28px; font-weight: bold; cursor: pointer; }
.modal h3 { text-align: center; margin-top: 0; color: #05f725;}
.modal form { display: flex; flex-direction: column; gap: 15px; }
.modal input { padding: 12px; border-radius: 20px 0px 20px 0px; border: 3px solid #4afd03; background-color: #3e3e3e; color: var(--text-light); font-size: 1em; }
.modal .form-btn { background-color: var(--accent-blue); color: rgb(247, 5, 5); border: 3px solid #ecfd05 !important; padding: 12px; border: none; border-radius: 0px 20px 0px 20px; font-size: 1.1em; cursor: pointer; }
.modal p { text-align: center; font-size: 0.9em; margin-top: 15px; color: gold;}
.modal p a { color: var(--accent-blue); text-decoration: none; font-weight: bold; }

/* --- Add Question Screen --- */
#add-question-form { display: flex; flex-direction: column; gap: 15px; }
#add-question-form input, #add-question-form select, #add-question-form textarea {
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--accent-blue);
    background-color: #3e3e3e;
    color: var(--text-light);
    font-size: 1em;
}


/* --- Animation --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
