/* 
    AI STUDY BUDDY 
    School Project Stylesheet 
*/

:root {
    --primary-blue: #4a90e2;
    --light-blue: #e8f0fe;
    --primary-purple: #9b59b6;
    --accent-yellow: #f1c40f;
    --background-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-dark: #333333;
    --text-light: #666666;
    --success-green: #2ecc71;
    --error-red: #e74c3c;
    --border-radius: 15px;
    --box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Utilities */
.hidden {
    display: none !important;
}

.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

.centered {
    text-align: center;
    max-width: 500px;
    margin: 50px auto;
}

.section {
    margin-bottom: 30px;
}

.section h2 {
    color: var(--primary-blue);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--light-blue);
    padding-bottom: 5px;
}

.section h3 {
    margin-bottom: 10px;
    color: var(--text-dark);
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    transition: transform 0.2s, background-color 0.2s;
}

button:active {
    transform: scale(0.95);
}

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

.primary-btn:hover {
    background-color: #357abd;
}

.secondary-btn {
    background-color: var(--primary-purple);
    color: white;
}

.icon-btn {
    background-color: #e0e0e0;
    color: var(--text-dark);
    font-size: 14px;
    padding: 8px 15px;
}

.demo-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    background-color: var(--accent-yellow);
    color: #333;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

/* Layout */
main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.two-col-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.three-col-layout {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

/* Header & Intro */
.header {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--primary-blue);
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--accent-yellow);
}

/* Name Entry */
#student-name-input {
    padding: 12px;
    font-size: 16px;
    width: 80%;
    border: 2px solid var(--light-blue);
    border-radius: 8px;
    margin-bottom: 15px;
}

.greeting-text {
    text-align: center;
    color: var(--primary-purple);
    margin-bottom: 30px;
    font-size: 1.8em;
}

/* Subjects */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.subject-card {
    background-color: white;
    border: 2px solid var(--light-blue);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.subject-card:hover {
    background-color: var(--light-blue);
    transform: translateY(-2px);
}

.subject-card.active {
    background-color: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

/* Suggested Questions */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

.chip:hover {
    background-color: var(--light-blue);
    border-color: var(--primary-blue);
}

/* Ask Section */
.input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#question-input {
    flex-grow: 1;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #ccc;
    border-radius: 8px;
}

/* Thinking Animation */
#thinking-indicator {
    text-align: center;
    color: var(--primary-purple);
    font-weight: bold;
    font-size: 18px;
    margin: 20px 0;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* Answer Display */
.answer-display {
    background-color: var(--light-blue);
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid var(--primary-blue);
    margin-top: 20px;
}

.answer-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.answer-title {
    font-size: 14px;
    color: var(--primary-blue);
    margin-top: 15px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.example-box {
    background-color: white;
    padding: 10px;
    border-radius: 5px;
    font-style: italic;
    border: 1px solid #ccc;
}

#ans-points {
    padding-left: 20px;
}

.trivia-box {
    background-color: var(--accent-yellow);
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
}

/* Quiz Section */
.quiz-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 18px;
}

.timer {
    color: var(--error-red);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    padding: 15px;
    background-color: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}

.quiz-option:hover {
    background-color: #eee;
}

.quiz-option.correct {
    background-color: #d5f5e3;
    border-color: var(--success-green);
}

.quiz-option.wrong {
    background-color: #fadbd8;
    border-color: var(--error-red);
}

.quiz-feedback {
    margin-top: 15px;
    font-weight: bold;
    font-size: 18px;
    text-align: center;
}

#quiz-result-area {
    text-align: center;
}

.celebration {
    color: var(--primary-purple);
    font-size: 2em;
}

.score-text {
    font-size: 1.5em;
    font-weight: bold;
    margin: 10px 0;
}

/* Progress Tracker & Badges */
.progress-stats p {
    font-size: 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.progress-bar-container {
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0 5px 0;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--success-green);
    transition: width 0.5s ease;
}

.progress-text {
    text-align: right;
    font-weight: bold;
    font-size: 14px;
}

.badges {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.badge {
    background-color: #fff9c4;
    border: 2px solid var(--accent-yellow);
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    transition: transform 0.3s;
}

.badge.locked {
    background-color: #f0f0f0;
    border-color: #ccc;
    color: #999;
    opacity: 0.6;
}

/* Timers & Facts */
.streak-card {
    text-align: center;
}

.streak-flame {
    font-size: 2em;
    color: #e67e22;
    margin: 15px 0;
    font-weight: bold;
}

.study-timer {
    text-align: center;
}

.timer-large {
    font-size: 3em;
    font-weight: bold;
    color: var(--primary-blue);
    margin: 10px 0;
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.fun-facts {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: #e8f8f5;
}

.fact-text {
    font-size: 18px;
    font-style: italic;
    color: #1abc9c;
}

/* Challenge */
.challenge-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.challenge-btn {
    background-color: white;
    border: 2px solid var(--primary-purple);
    color: var(--primary-purple);
}

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

.challenge-feedback {
    margin-top: 15px;
    padding: 15px;
    background-color: #d1c4e9;
    border-radius: 8px;
}

/* Learning & About */
.learning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.learning-card {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    font-size: 14px;
}

.code-box {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 18px;
    margin-bottom: 10px;
}

.about-section {
    background-color: var(--primary-blue);
    color: white;
    text-align: center;
}
.about-section h2 { color: white; border-bottom-color: rgba(255,255,255,0.3); }

/* Parent Demo Overlay */
.demo-overlay {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: white;
    border: 4px solid var(--accent-yellow);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 1000;
    width: 300px;
}

.demo-overlay h2 {
    color: var(--primary-blue);
    margin-bottom: 10px;
}


/* =========================================================
   PURE HTML/CSS ROBOT 
   ========================================================= */
.robot {
    margin: 20px auto 0;
    width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.robot-antenna {
    width: 6px;
    height: 20px;
    background-color: #bdc3c7;
    position: relative;
}
.robot-antenna::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -4px;
    width: 14px;
    height: 14px;
    background-color: var(--accent-yellow);
    border-radius: 50%;
}

.robot-head {
    width: 100px;
    height: 80px;
    background-color: #ecf0f1;
    border: 4px solid #95a5a6;
    border-radius: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.robot-eyes {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.eye {
    width: 16px;
    height: 16px;
    background-color: var(--primary-blue);
    border-radius: 50%;
    animation: blink 4s infinite;
}

.robot-mouth {
    width: 40px;
    height: 10px;
    background-color: #34495e;
    border-radius: 10px;
    transition: 0.3s;
}

.robot-body {
    width: 120px;
    height: 90px;
    background-color: var(--primary-blue);
    border-radius: 15px;
    border: 4px solid #2980b9;
    margin-top: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.robot-screen {
    width: 80px;
    height: 40px;
    background-color: #2c3e50;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.robot-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: -40px;
    width: 20px;
    height: 100%;
    background-color: rgba(255,255,255,0.2);
    transform: skewX(-20deg);
    animation: shine 3s infinite;
}

/* Robot States (Controlled by JS) */
.robot-head.thinking .eye {
    background-color: var(--accent-yellow);
    animation: think-eye 0.5s infinite alternate;
}
.robot-head.thinking .robot-mouth {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.robot-head.happy .robot-mouth {
    height: 20px;
    border-radius: 0 0 20px 20px;
    background-color: var(--success-green);
}

.robot-head.sad .robot-mouth {
    height: 20px;
    border-radius: 20px 20px 0 0;
    background-color: var(--error-red);
}

/* Animations */
@keyframes blink {
    0%, 96%, 98%, 100% { transform: scaleY(1); }
    97%, 99% { transform: scaleY(0.1); }
}

@keyframes think-eye {
    from { transform: scale(1); }
    to { transform: scale(1.3); }
}

@keyframes shine {
    0% { left: -40px; }
    20% { left: 100px; }
    100% { left: 100px; }
}

/* Responsive */
@media (max-width: 768px) {
    .two-col-layout, .three-col-layout {
        grid-template-columns: 1fr;
    }
    .subject-grid {
        grid-template-columns: 1fr;
    }
    .input-row {
        flex-direction: column;
    }
}
