/* ===== CSS Variables ===== */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --accent-color: #FF9800;
    --danger-color: #f44336;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e0e0e0;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    
    --nav-height: 70px;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.4);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

a {
    text-decoration: none;
    color: var(--primary-color);
}

/* ===== Auth Bar ===== */
.auth-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: flex-end;
    padding: 8px 16px;
    font-size: 0.85rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1001; /* Above navbar */
    box-sizing: border-box;
}

[data-theme='dark'] .auth-bar {
    background: #1f2937;
    border-color: #374151;
}

.auth-status-ok {
    color: var(--success-color);
    font-weight: 600;
}

.auth-status-warn {
    color: var(--warning-color);
    font-weight: 600;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    display: inline-block;
    margin-right: 4px;
}

.sync-dot.off {
    background: #9ca3af;
}

button.auth-btn {
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    cursor: pointer;
    transition: var(--transition);
}

[data-theme='dark'] button.auth-btn {
    background: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

button.auth-btn:hover {
    background: var(--bg-tertiary);
}

[data-theme='dark'] button.auth-btn:hover {
    background: #1e293b;
}

/* ===== Navigation ===== */
.navbar {
    background-color: var(--bg-primary);
    box-shadow: var(--shadow);
    position: fixed;
    top: 38px; /* Below auth bar */
    width: 100%;
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--nav-height);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

.theme-toggle {
    background: var(--bg-secondary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* ===== Main Content ===== */
main {
    margin-top: calc(var(--nav-height) + 38px); /* Auth bar (38px) + navbar */
    min-height: calc(100vh - var(--nav-height) - 38px);
}

.section {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
    animation: fadeIn 0.5s ease;
}

.section.active {
    display: block;
}

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

/* ===== Hero Section ===== */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius);
    color: white;
    margin-bottom: 3rem;
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    animation: slideDown 0.8s ease;
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Progress Overview ===== */
.progress-overview {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

.progress-card {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
}

.circular-progress {
    position: relative;
    margin: 1rem auto;
    width: 120px;
    height: 120px;
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.5s ease;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: bold;
}

.progress-info {
    margin: 1rem 0;
    font-size: 1.1rem;
}

/* ===== Buttons ===== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-block;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

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

/* ===== Overview Grid ===== */
.program-overview {
    margin: 3rem 0;
}

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

.overview-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

.overview-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ===== Curriculum Section ===== */
.curriculum-filters {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.modules-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.module {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.module:hover {
    box-shadow: var(--shadow-hover);
}

.module-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.module-duration {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.module-content {
    padding: 2rem;
}

.day-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.day-card {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.day-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.day-card.completed {
    border-left-color: var(--success-color);
    opacity: 0.8;
}

.day-card.completed::after {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--success-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.day-number {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.day-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.day-topics {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== Progress Dashboard ===== */
.progress-dashboard {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ===== Achievements ===== */
.achievements {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius);
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.achievement {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 8px;
    transition: var(--transition);
}

.achievement:hover {
    transform: scale(1.05);
}

.achievement.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.achievement-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.achievement-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ===== Resources Section ===== */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.resource-category {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.glossary-search input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.glossary-list {
    max-height: 400px;
    overflow-y: auto;
}

.glossary-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.glossary-term {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.glossary-definition {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== Model Comparison ===== */
.model-comparison {
    overflow-x: auto;
}

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

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

.comparison-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.rating {
    color: var(--accent-color);
}

/* ===== Cheat Sheets ===== */
.cheatsheet-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cheatsheet-btn {
    padding: 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    color: var(--text-primary);
    transition: var(--transition);
}

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

.external-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.resource-link {
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    display: block;
    transition: var(--transition);
}

.resource-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

/* ===== Prompt Playground ===== */
.playground-container {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius);
}

.playground-header {
    text-align: center;
    margin-bottom: 2rem;
}

.playground-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.playground-input,
.playground-analysis {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}

#promptInput {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 1rem;
}

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

.prompt-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.analysis-result {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    min-height: 200px;
    margin-bottom: 1rem;
}

.placeholder-text {
    color: var(--text-secondary);
    font-style: italic;
}

.prompt-score {
    margin-top: 1rem;
}

.score-bar {
    background: var(--bg-tertiary);
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    margin: 1rem 0;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger-color), var(--warning-color), var(--success-color));
    transition: width 0.5s ease;
}

.score-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* ===== Templates ===== */
.prompt-templates {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

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

.template-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    cursor: pointer;
    transition: var(--transition);
}

.template-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.template-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.template-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.template-example {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
}

/* ===== Challenges ===== */
.prompt-challenges {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius);
}

.challenge-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    border: 2px solid var(--accent-color);
}

.challenge-title {
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.challenge-desc {
    margin-bottom: 1rem;
}

.challenge-requirements {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.challenge-requirements ul {
    margin-left: 1.5rem;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--bg-primary);
    margin: 3% auto;
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--danger-color);
}

/* ===== Day Content Styling ===== */
.lesson-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.lesson-body {
    line-height: 1.8;
}

.lesson-section {
    margin-bottom: 2rem;
}

.lesson-section h3 {
    color: var(--primary-color);
    margin-top: 1.5rem;
}

.code-example {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
}

.tip-box, .warning-box, .info-box {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid;
}

.tip-box {
    background: rgba(76, 175, 80, 0.1);
    border-color: var(--success-color);
}

.warning-box {
    background: rgba(255, 193, 7, 0.1);
    border-color: var(--warning-color);
}

.info-box {
    background: rgba(33, 150, 243, 0.1);
    border-color: var(--secondary-color);
}

.exercise-box {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin: 2rem 0;
}

.quiz-container {
    margin-top: 2rem;
}

.quiz-question {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.quiz-option {
    padding: 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.quiz-option:hover {
    border-color: var(--primary-color);
}

.quiz-option.correct {
    border-color: var(--success-color);
    background: rgba(76, 175, 80, 0.1);
}

.quiz-option.incorrect {
    border-color: var(--danger-color);
    background: rgba(244, 67, 54, 0.1);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .overview-grid {
        grid-template-columns: 1fr;
    }
    
    .playground-grid {
        grid-template-columns: 1fr;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        padding: 1rem;
    }
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--text-secondary); }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
