/* Terminal 43 OS — Custom Theme */

:root {
    --t43-glow-green: 0 0 20px rgba(0, 255, 65, 0.15);
    --t43-glow-blue: 0 0 20px rgba(88, 166, 255, 0.15);
    --t43-shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0a0e14; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* Selection */
::selection { background: rgba(0, 255, 65, 0.2); color: #e6edf3; }

/* Terminal cursor blink */
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.cursor-blink { animation: blink 1s step-end infinite; }

/* Glow effects */
.glow-green { box-shadow: var(--t43-glow-green); }
.glow-green-text { text-shadow: 0 0 10px rgba(0, 255, 65, 0.4); }
.glow-blue { box-shadow: var(--t43-glow-blue); }

/* Card hover */
.card-hover {
    transition: all 0.2s ease;
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--t43-shadow-card), 0 0 20px rgba(0, 255, 65, 0.08);
    border-color: #39d353;
}

/* Difficulty badges */
.diff-trivial { color: #39d353; background: rgba(57, 211, 83, 0.1); }
.diff-easy { color: #e3b341; background: rgba(227, 179, 65, 0.1); }
.diff-medium { color: #f0883e; background: rgba(240, 136, 62, 0.1); }
.diff-hard { color: #f85149; background: rgba(248, 81, 73, 0.1); }
.diff-insane { color: #bc8cff; background: rgba(188, 140, 255, 0.1); }

/* Progress bar */
.progress-bar {
    background: #21262d;
    border-radius: 9999px;
    overflow: hidden;
}
.progress-fill {
    background: linear-gradient(90deg, #1a7f37, #39d353, #00ff41);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

/* Typing animation */
@keyframes typing { from { width: 0; } to { width: 100%; } }
.typing-effect {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid #00ff41;
    animation: typing 2s steps(30) forwards, blink 1s step-end infinite;
}

/* GSAP animation initial state */
.gsap-fade { opacity: 0; transform: translateY(30px); }
.gsap-fade-left { opacity: 0; transform: translateX(-30px); }
.gsap-fade-right { opacity: 0; transform: translateX(30px); }

/* Flash messages auto-dismiss */
.flash-msg { animation: fadeIn 0.3s ease, fadeOut 0.3s ease 4s forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; } }

/* Scanline overlay */
.scanline::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
    pointer-events: none;
}

/* Stat card */
.stat-card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: border-color 0.2s;
}
.stat-card:hover { border-color: #39d353; }

/* Pulse animation for container status */
@keyframes pulse-green { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pulse-green { animation: pulse-green 2s ease-in-out infinite; }

/* Code blocks */
pre code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
}

/* ── Prose / Markdown Content Styling ── */
#lesson-content h1 { font-size: 1.75rem; font-weight: 700; color: #e6edf3; margin: 1.5rem 0 0.75rem; }
#lesson-content h2 { font-size: 1.35rem; font-weight: 700; color: #e6edf3; margin: 2rem 0 0.6rem; padding-bottom: 0.3rem; border-bottom: 1px solid #21262d; }
#lesson-content h3 { font-size: 1.1rem; font-weight: 600; color: #c9d1d9; margin: 1.5rem 0 0.5rem; }
#lesson-content p { margin: 0.6rem 0; line-height: 1.7; }
#lesson-content strong { color: #e6edf3; }
#lesson-content em { color: #c9d1d9; }
#lesson-content a { color: #58a6ff; text-decoration: underline; }
#lesson-content ul, #lesson-content ol { margin: 0.5rem 0; padding-left: 1.5rem; }
#lesson-content li { margin: 0.25rem 0; line-height: 1.6; }
#lesson-content ul li { list-style: disc; }
#lesson-content ol li { list-style: decimal; }
#lesson-content blockquote { border-left: 3px solid #39d353; padding: 0.5rem 1rem; margin: 1rem 0; background: rgba(57, 211, 83, 0.05); border-radius: 0 0.5rem 0.5rem 0; }
#lesson-content blockquote p { margin: 0.25rem 0; }
#lesson-content pre { background: #0d1117; border: 1px solid #21262d; border-radius: 0.5rem; padding: 1rem; overflow-x: auto; margin: 0.75rem 0; }
#lesson-content pre code { background: none; border: none; padding: 0; font-size: 0.85rem; color: #e6edf3; }
#lesson-content code { background: #21262d; color: #f0883e; padding: 0.15rem 0.4rem; border-radius: 0.25rem; font-family: 'JetBrains Mono', monospace; font-size: 0.85em; }
#lesson-content table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.9rem; }
#lesson-content th { background: #161b22; padding: 0.6rem 0.75rem; text-align: left; border-bottom: 2px solid #30363d; color: #e6edf3; font-weight: 600; }
#lesson-content td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #21262d; }
#lesson-content tr:hover { background: rgba(22, 27, 34, 0.5); }
#lesson-content hr { border: none; border-top: 1px solid #21262d; margin: 1.5rem 0; }
#lesson-content h1:first-child { display: none; }

/* Table styles */
.t43-table { width: 100%; border-collapse: collapse; }
.t43-table thead { background: #161b22; }
.t43-table th { padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #8b949e; border-bottom: 1px solid #21262d; }
.t43-table td { padding: 0.75rem 1rem; border-bottom: 1px solid #21262d; font-size: 0.875rem; }
.t43-table tbody tr:hover { background: #161b22; }

/* Form inputs */
.t43-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 0.5rem;
    color: #e6edf3;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}
.t43-input:focus {
    outline: none;
    border-color: #39d353;
    box-shadow: 0 0 0 3px rgba(57, 211, 83, 0.15);
}
.t43-input::placeholder { color: #484f58; }

/* Buttons */
.btn-primary {
    background: #39d353;
    color: #0a0e14;
    font-weight: 700;
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}
.btn-primary:hover { background: #00ff41; box-shadow: 0 0 15px rgba(0, 255, 65, 0.3); }

.btn-secondary {
    background: #21262d;
    color: #e6edf3;
    font-weight: 500;
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid #30363d;
    transition: all 0.2s;
    cursor: pointer;
}
.btn-secondary:hover { background: #30363d; border-color: #484f58; }

.btn-danger {
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
    font-weight: 500;
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(248, 81, 73, 0.3);
    transition: all 0.2s;
    cursor: pointer;
}
.btn-danger:hover { background: rgba(248, 81, 73, 0.2); }

/* Toast slide-in */
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.animate-slide-in { animation: slideIn 0.3s ease-out; }

/* Confetti burst — challenge solve celebration */
@keyframes confettiBurst {
    0% { transform: scale(0); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0; }
}
.confetti-burst {
    position: fixed; top: 50%; left: 50%; width: 200px; height: 200px;
    margin: -100px 0 0 -100px; z-index: 200; pointer-events: none;
    border-radius: 50%; background: radial-gradient(circle, rgba(0,255,65,0.4) 0%, transparent 70%);
    animation: confettiBurst 0.8s ease-out forwards;
}

/* ── Light Theme ── */
html:not(.dark) body { background: #f6f8fa; color: #1f2328; }
html:not(.dark) .bg-t43-black { background: #f6f8fa; }
html:not(.dark) .bg-t43-darker { background: #ffffff; }
html:not(.dark) .bg-t43-dark { background: #ffffff; }
html:not(.dark) .bg-t43-medium { background: #d0d7de; }
html:not(.dark) .border-t43-medium { border-color: #d0d7de; }
html:not(.dark) .text-t43-text { color: #1f2328; }
html:not(.dark) .text-t43-text-secondary { color: #656d76; }
html:not(.dark) .text-t43-text-tertiary { color: #8b949e; }
html:not(.dark) .stat-card { background: #ffffff; border-color: #d0d7de; }
html:not(.dark) .t43-input { background: #ffffff; border-color: #d0d7de; color: #1f2328; }
html:not(.dark) .t43-table td { border-color: #d0d7de; }
html:not(.dark) .t43-table thead { background: #f6f8fa; }
html:not(.dark) nav.bg-t43-darker { background: #ffffff; border-color: #d0d7de; }
html:not(.dark) footer.bg-t43-darker { background: #ffffff; border-color: #d0d7de; }
html:not(.dark) ::-webkit-scrollbar-track { background: #f6f8fa; }
html:not(.dark) ::-webkit-scrollbar-thumb { background: #d0d7de; }
html:not(.dark) ::selection { background: rgba(0, 255, 65, 0.15); color: #1f2328; }
html:not(.dark) #lesson-content pre { background: #f6f8fa; border-color: #d0d7de; }
html:not(.dark) #lesson-content pre code { color: #1f2328; }
html:not(.dark) #lesson-content code { background: #eff1f3; color: #cf222e; }
html:not(.dark) #lesson-content h1, html:not(.dark) #lesson-content h2 { color: #1f2328; }
html:not(.dark) #lesson-content h2 { border-color: #d0d7de; }
html:not(.dark) #lesson-content th { background: #f6f8fa; color: #1f2328; }
html:not(.dark) #lesson-content td { border-color: #d0d7de; }
html:not(.dark) #lesson-content blockquote { background: rgba(57,211,83,0.08); }
html:not(.dark) .progress-bar { background: #d0d7de; }

/* ── Landing Page & Dashboard Animation Enhancements ── */

/* Hero grid background */
.hero-grid-bg {
    background-image:
        linear-gradient(rgba(0, 255, 65, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Section divider with gradient fade */
.section-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.2), transparent);
}

/* GSAP initial state — scale entrance */
.gsap-scale { opacity: 0; transform: scale(0.8); }

/* Dashboard GSAP initial states */
.dash-stat { opacity: 0; transform: translateY(30px) scale(0.95); }
.dash-container-card { opacity: 0; transform: translateX(-20px); }
.dash-submission { opacity: 0; transform: translateY(15px); }
.dash-sidebar-card { opacity: 0; transform: translateX(20px); }
.dash-classroom { opacity: 0; transform: translateX(20px); }

/* Enhanced status dot for running containers */
.status-dot-running {
    width: 10px; height: 10px;
    background: #39d353; border-radius: 50%;
    box-shadow: 0 0 8px rgba(57, 211, 83, 0.5);
    animation: pulse-green 2s ease-in-out infinite;
}

/* Sidebar icon hover shift */
.icon-shift-right { transition: transform 0.2s ease; }
.card-hover:hover .icon-shift-right { transform: translateX(3px); }

/* Stat value hover scale */
.stat-value-hover { transition: transform 0.15s ease; display: inline-block; }
.stat-card:hover .stat-value-hover { transform: scale(1.05); }

/* Course card accent bars by difficulty */
.course-accent::before {
    content: ''; display: block; height: 2px;
    border-radius: 2px 2px 0 0;
    margin: -1.25rem -1.25rem 1rem -1.25rem;
}
.course-accent-beginner::before { background: #39d353; }
.course-accent-intermediate::before { background: #f0883e; }
.course-accent-advanced::before { background: #f85149; }
.course-accent-expert::before { background: #bc8cff; }

/* Submission result pill */
.result-pill-success {
    background: rgba(13, 40, 24, 0.8);
    padding: 2px 8px; border-radius: 9999px; font-size: 0.75rem;
}

/* Section glow border bottom */
.glow-border-bottom { position: relative; }
.glow-border-bottom::after {
    content: ''; position: absolute;
    bottom: 0; left: 10%; right: 10%; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.3), transparent);
}

/* Light theme overrides for new classes */
html:not(.dark) .hero-grid-bg {
    background-image:
        linear-gradient(rgba(0, 100, 30, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 100, 30, 0.04) 1px, transparent 1px);
}
html:not(.dark) .section-divider {
    background: linear-gradient(90deg, transparent, rgba(0, 100, 30, 0.15), transparent);
}
