/* =============================================
   style.css – Darwin Carl F. Mirales
   Modern Clean UI for JS Activities
   ============================================= */

:root {
    --bg: #f4f6fb;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: rgba(99,102,241,0.15);
    --sidebar-active-text: #818cf8;
    --sidebar-hover: rgba(255,255,255,0.06);
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent2: #10b981;
    --accent3: #f59e0b;
    --accent4: #ec4899;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --btn-primary: #6366f1;
    --btn-primary-hover: #4f46e5;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'Space Mono', monospace;
    --sidebar-width: 240px;
    --topbar-height: 60px;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: #1e293b #0f172a;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: #0f172a; }
.sidebar::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.brand-icon {
    font-size: 20px;
    color: var(--accent-light);
    font-family: var(--font-mono);
    font-weight: 700;
}
.brand-text {
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: 0.3px;
}

.nav-section {
    padding: 12px 10px 4px;
    flex-shrink: 0;
}
.nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #475569;
    padding: 0 10px 8px;
}
.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    transition: all 0.18s ease;
    line-height: 1.3;
}
.nav-btn:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}
.nav-btn.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 500;
}
.nav-btn .nav-icon { font-size: 14px; flex-shrink: 0; }

/* Exercise 3 blue accent */
.nav-btn.ex3-style { color: #7dd3fc; }
.nav-btn.ex3-style:hover { background: rgba(14,165,233,0.12); color: #bae6fd; }
.nav-btn.ex3-style.active { background: rgba(14,165,233,0.15); color: #38bdf8; }

/* Exercise 4 green accent */
.nav-btn.ex4-style { color: #6ee7b7; }
.nav-btn.ex4-style:hover { background: rgba(16,185,129,0.12); color: #a7f3d0; }
.nav-btn.ex4-style.active { background: rgba(16,185,129,0.15); color: #34d399; }

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.07);
    font-size: 11.5px;
    color: #475569;
    line-height: 1.8;
}

/* =============================================
   MAIN WRAPPER
   ============================================= */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* =============================================
   TOPBAR
   ============================================= */
.topbar {
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 0 #e2e8f0;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}
.topbar-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
}
.topbar-badge {
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

/* =============================================
   CONTENT AREA
   ============================================= */
.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    gap: 16px;
}
.welcome-icon {
    font-size: 52px;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
}
.welcome-screen h2 {
    font-size: 26px;
    font-weight: 600;
    color: var(--text);
}
.welcome-screen > p {
    color: var(--text-muted);
    font-size: 15px;
}
.welcome-cards {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}
.welcome-card {
    background: white;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 130px;
    box-shadow: var(--shadow);
    cursor: default;
    transition: transform 0.2s, box-shadow 0.2s;
}
.welcome-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.welcome-card span { font-size: 26px; }
.welcome-card strong { font-size: 13px; font-weight: 600; }
.welcome-card small { font-size: 11px; color: var(--text-muted); }

/* =============================================
   ACTIVITY CARD
   ============================================= */
.activity-header {
    margin-bottom: 28px;
}
.activity-header .ex-tag {
    font-size: 11px;
    font-family: var(--font-mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 6px;
}
.activity-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
}
.activity-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* Card */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Output box */
.output-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #334155;
    min-height: 48px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    margin-top: 14px;
}
.output-box.success { border-left: 3px solid var(--accent2); background: #f0fdf4; }
.output-box.error { border-left: 3px solid #ef4444; background: #fef2f2; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    line-height: 1;
}
.btn-primary {
    background: var(--btn-primary);
    color: white;
}
.btn-primary:hover { background: var(--btn-primary-hover); transform: translateY(-1px); }
.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--card-border);
}
.btn-secondary:hover { background: #f1f5f9; }
.btn-danger {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.btn-danger:hover { background: #fecaca; }
.btn-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.btn-success:hover { background: #a7f3d0; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* Inputs */
.input-field {
    padding: 9px 13px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}
.input-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
}

/* =============================================
   EXERCISE 1 – LAYOUT PREVIEW
   ============================================= */
.layout-preview {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 12px;
    background: #f8fafc;
}
.layout-preview-inner {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 8px;
    height: 380px;
}
.lp-header {
    background: var(--sidebar-bg);
    color: #94a3b8;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
}
.lp-body {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px;
    min-height: 0;
}
.lp-sidebar {
    background: #1e293b;
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.lp-nav-item {
    background: rgba(255,255,255,0.07);
    border-radius: 5px;
    height: 22px;
    width: 100%;
}
.lp-nav-item:first-child { background: rgba(99,102,241,0.4); }
.lp-content {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 18px;
}
.lp-content-line {
    height: 10px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-bottom: 10px;
}
.lp-content-line:nth-child(1) { width: 60%; }
.lp-content-line:nth-child(2) { width: 90%; }
.lp-content-line:nth-child(3) { width: 75%; }
.lp-content-line:nth-child(4) { width: 85%; }
.lp-footer {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}
.layout-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* =============================================
   EXERCISE 3 – DOM ACTIVITIES
   ============================================= */
.ex3-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.ex3-card {
    background: white;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.ex3-card .act-num {
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 700;
    color: #0ea5e9;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.ex3-card .act-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}
.ex3-card .act-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}
.ex3-demo {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
}

/* To-do list */
#ex3-todo-list {
    list-style: none;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
#ex3-todo-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
#ex3-todo-list li:hover { background: #fee2e2; }
#ex3-todo-list li::after { content: '✕'; font-size: 11px; color: #94a3b8; }

/* Item list */
#ex3-item-list {
    list-style: none;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
#ex3-item-list li {
    padding: 7px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
}

/* Color patches */
.color-patches {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.color-patch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
    cursor: pointer;
}

/* =============================================
   EXERCISE 4 – GRADE CALCULATOR
   ============================================= */
.grade-calc-wrapper {
    max-width: 560px;
}
.grade-inputs {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}
.grade-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.grade-input-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}
.grade-input-group .weight-tag {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.grade-input-group .input-field { width: 100%; }

.result-card {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border-radius: var(--radius);
    padding: 24px;
    display: none;
    margin-top: 20px;
}
.result-card.show { display: block; }
.result-grade-num {
    font-size: 56px;
    font-family: var(--font-mono);
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}
.result-equiv {
    font-size: 32px;
    font-family: var(--font-mono);
    font-weight: 700;
    opacity: 0.9;
}
.result-breakdown {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-size: 13px;
    opacity: 0.85;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.result-breakdown span { font-family: var(--font-mono); }

/* Grade scale table */
.grade-scale {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 20px;
}
.grade-scale-item {
    text-align: center;
    padding: 10px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
    font-family: var(--font-mono);
    font-size: 13px;
}
.grade-scale-item .grade-letter {
    font-size: 20px;
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}
.grade-scale-item.grade-a { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.grade-scale-item.grade-b { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.grade-scale-item.grade-c { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.grade-scale-item.grade-d { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
.grade-scale-item.grade-f { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.grade-scale-item.active-grade {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* =============================================
   CALCULATOR (Exercise 2 Act 3)
   ============================================= */
.calc-result-area {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--text);
    min-height: 48px;
    margin-top: 14px;
    text-align: right;
}

/* =============================================
   DARK MODE OVERRIDE
   ============================================= */
body.dark-mode {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --card-border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --input-bg: #0f172a;
    --input-border: #334155;
    background: var(--bg);
    color: var(--text);
}
body.dark-mode .topbar { background: #1e293b; border-color: #334155; }
body.dark-mode .footer { background: #1e293b; border-color: #334155; }
body.dark-mode .lp-content { background: #1e293b; border-color: #334155; }
body.dark-mode .lp-content-line { background: #334155; }
body.dark-mode .ex3-demo { background: #0f172a; border-color: #334155; }
body.dark-mode .output-box { background: #0f172a; border-color: #334155; color: #94a3b8; }
body.dark-mode #ex3-todo-list li { background: #1e293b; border-color: #334155; }
body.dark-mode #ex3-item-list li { background: #1e293b; border-color: #334155; }
body.dark-mode .calc-result-area { background: #0f172a; border-color: #334155; }
body.dark-mode .input-field { background: #1e293b; border-color: #334155; color: #f1f5f9; }
body.dark-mode .card { background: var(--card-bg); border-color: var(--card-border); }
body.dark-mode .ex3-card { background: var(--card-bg); border-color: var(--card-border); }
body.dark-mode .welcome-card { background: var(--card-bg); border-color: var(--card-border); color: var(--text); }
body.dark-mode .btn-secondary { color: var(--text); border-color: var(--card-border); }
body.dark-mode .btn-secondary:hover { background: #334155; }
body.dark-mode .layout-preview { border-color: #334155; background: #0f172a; }
body.dark-mode .grade-scale-item { background: #1e293b; border-color: #334155; color: #94a3b8; }
body.dark-mode .grade-scale-item.grade-a { background: #064e3b; border-color: #065f46; color: #6ee7b7; }
body.dark-mode .grade-scale-item.grade-b { background: #1e3a5f; border-color: #1e40af; color: #93c5fd; }
body.dark-mode .grade-scale-item.grade-c { background: #78350f; border-color: #92400e; color: #fcd34d; }
body.dark-mode .grade-scale-item.grade-d { background: #7c2d12; border-color: #9a3412; color: #fdba74; }
body.dark-mode .grade-scale-item.grade-f { background: #7f1d1d; border-color: #991b1b; color: #fca5a5; }
body.dark-mode .lp-footer { background: #1e293b; border-color: #334155; }

/* =============================================
   FOOTER
   ============================================= */
.footer {
    padding: 14px 32px;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-muted);
    border-top: 1px solid var(--card-border);
    background: white;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    :root { --sidebar-width: 240px; }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    .main-wrapper { margin-left: 0; }
    .menu-toggle { display: flex; }
    .content-area { padding: 20px 16px; }
    .ex3-grid { grid-template-columns: 1fr; }
    .grade-scale { grid-template-columns: repeat(3, 1fr); }
    .topbar { padding: 0 16px; }
}
