:root {
    --bg-color: #f8faf8;
    --card-bg: #ffffff;
    --primary: #2d5a27;
    --primary-light: #4a8a42;
    --accent: #e8f5e9;
    --text-main: #1a1c1a;
    --text-muted: #5e665e;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* Navigation */
#main-nav {
    background: var(--card-bg);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary);
}

.nav-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.progress-container {
    width: 100px;
    height: 8px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: var(--transition);
}

.xp-badge {
    background: var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
    color: var(--primary);
}

/* Layout Containers */
#app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 80vh;
}

/* Home Page */
.hero-card {
    text-align: center;
    max-width: 700px;
    margin: 4rem auto;
    padding: 3rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent);
    color: var(--primary);
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

h1 span { color: var(--primary); }

.hero-intro {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.course-meta {
    margin-bottom: 3rem;
    font-weight: 600;
    color: var(--text-muted);
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

input[type="text"] {
    width: 100%;
    max-width: 300px;
    padding: 1rem;
    border: 2px solid #eee;
    border-radius: 12px;
    font-size: 1rem;
    text-align: center;
    transition: var(--transition);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
}

.btn-back {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 1rem;
}

/* Dashboard Grid */
.section-header { margin-bottom: 2rem; }

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.module-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
}

.module-card:hover:not(.locked) {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.module-card.locked {
    opacity: 0.7;
    cursor: not-allowed;
    background: #f0f2f0;
}

.module-card.completed {
    border-color: var(--primary);
}

.mod-num {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
}

.mod-icon {
    font-size: 2rem;
    margin: 1rem 0;
}

.mod-title {
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.mod-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.mod-status {
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
}

/* Module Content Page */
#module-content {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.video-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: #eef1ee;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
    border: 2px dashed #ccc;
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.info-card {
    background: var(--accent);
    padding: 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
}

.quiz-section {
    background: #fdfdfd;
    border: 1px solid #eee;
    padding: 2rem;
    border-radius: 12px;
    margin-top: 2rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.option-btn {
    padding: 1rem;
    border: 2px solid #eee;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition);
}

.option-btn:hover { border-color: var(--primary); }
.option-btn.correct { background: #d4edda; border-color: #28a745; }
.option-btn.wrong { background: #f8d7da; border-color: #dc3545; }

.challenge-box {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #fff9e6;
    border-left: 4px solid #f39c12;
    border-radius: 0 12px 12px 0;
}

/* Final Challenge */
.final-q-item {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.error-msg {
    color: #dc3545;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Completion */
.completion-card { text-align: center; }
.stats-summary {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
}
.summary-box {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    min-width: 140px;
    box-shadow: var(--shadow);
}
.summary-val {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

/* Certificate Styles */
.certificate {
    background: white;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    border: 2px solid #e0e0e0;
}

.cert-border {
    border: 10px double var(--primary);
    padding: 40px;
    text-align: center;
}

.cert-logo { font-weight: 800; color: var(--primary); margin-bottom: 2rem; }
.cert-awarded { font-style: italic; margin: 1rem 0; }
#cert-name { font-size: 3rem; margin: 1rem 0; text-decoration: underline; }
.cert-text { margin: 2rem auto; max-width: 600px; }
.cert-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    text-align: left;
}
.cert-meta { display: flex; flex-direction: column; }
.cert-seal { font-size: 4rem; margin-top: 1rem; }

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 2.2rem; }
    .nav-stats { gap: 0.5rem; }
    .nav-progress-text, .stat-label { display: none; }
    #app-container { padding: 1rem; }
}

/* Print Logic */
@media print {
    body * { visibility: hidden; }
    #view-certificate, #view-certificate * { visibility: visible; }
    #view-certificate { position: absolute; left: 0; top: 0; width: 100%; }
    .no-print { display: none; }
}