:root {
    --bg-color: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
    --btn-blue: #2563eb;
    --btn-blue-hover: #1d4ed8;
    --btn-red: #ef4444;
    --btn-red-hover: #dc2626;
    --nav-bg: #f8fafc;
    --editor-bg: #1e1e1e;
    --box-bg: #f3f4f6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--btn-blue);
    letter-spacing: -0.025em;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

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

/* Main Content */
main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.view.active-view {
    display: block;
}

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

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    color: white;
}

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

.btn-blue:hover:not(:disabled) {
    background-color: var(--btn-blue-hover);
}

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

.btn-red:hover:not(:disabled) {
    background-color: var(--btn-red-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Compiler View */
.compiler-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#compiler-select {
    padding: 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    outline: none;
}

.editor-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    height: 70vh;
}

.code-area {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#editor {
    width: 100%;
    height: 100%;
}

.io-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.io-box {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.io-box h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

#stdin-input {
    flex: 1;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    resize: none;
    font-family: monospace;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

#stdin-input:focus {
    border-color: var(--btn-blue);
}

.output-console {
    flex: 1;
    background-color: var(--editor-bg);
    color: #e5e5e5;
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 0.875rem;
    overflow-y: auto;
    white-space: pre-wrap;
}

#run-status.success { color: #10b981; font-size: 0.875rem; }
#run-status.error { color: #ef4444; font-size: 0.875rem; }

/* Subjects View */
.subjects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.breadcrumb {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.breadcrumb a {
    color: var(--btn-blue);
    text-decoration: none;
}
.breadcrumb a:hover {
    text-decoration: underline;
}

.search-bar input {
    padding: 0.75rem 1rem;
    width: 300px;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    font-size: 0.875rem;
    outline: none;
    transition: box-shadow 0.2s;
}

.search-bar input:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    border-color: var(--btn-blue);
}

.questions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.subject-card, .question-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.subject-card:hover, .question-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.q-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.q-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--btn-blue);
}

.q-actions {
    display: flex;
    gap: 0.5rem;
}

.q-code-preview {
    background-color: var(--box-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 0.875rem;
    overflow-x: auto;
    margin-top: 1rem;
    white-space: pre-wrap;
    border: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 1024px) {
    .editor-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .code-area {
        height: 50vh;
    }
    .io-area {
        flex-direction: row;
        height: 30vh;
    }
}
@media (max-width: 768px) {
    .subjects-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .search-bar input {
        width: 100%;
    }
    .io-area {
        flex-direction: column;
        height: auto;
    }
    .io-box {
        height: 200px;
    }
}

/* Cyberpunk Login View */
.login-view {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-color);
    z-index: 100;
}

.cyber-container {
    background: #09090b;
    color: #fff;
    padding: 3rem;
    border-radius: 0.5rem;
    box-shadow: 0 0 40px rgba(14, 165, 233, 0.1), inset 0 0 20px rgba(14, 165, 233, 0.05);
    text-align: center;
    width: 100%;
    max-width: 500px;
    border: 1px solid #1e293b;
    position: relative;
    overflow: hidden;
}

.cyber-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, #0ea5e9, transparent);
}

.glitch-text {
    font-family: monospace;
    font-size: 2.2rem;
    color: #ef4444;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.subtitle {
    color: #64748b;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    letter-spacing: 1px;
    font-family: monospace;
}

.login-box {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.login-box input {
    background: #111;
    border: 1px solid #333;
    color: #10b981;
    padding: 1rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
    text-align: center;
    letter-spacing: 2px;
}

.login-box input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.3);
}

.login-box input:disabled {
    background: #050505;
    border-color: #1f2937;
    color: #374151;
    cursor: not-allowed;
    pointer-events: none;
    user-select: none;
}

.cyber-btn-primary {
    width: 100%;
    padding: 1rem;
    background: transparent;
    color: #0ea5e9;
    border: 1px solid #0ea5e9;
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    text-shadow: 0 0 5px rgba(14, 165, 233, 0.5);
    box-shadow: inset 0 0 10px rgba(14, 165, 233, 0.1);
    transition: all 0.2s;
}

.cyber-btn-primary:hover {
    background: #0ea5e9;
    color: #000;
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
}

.cyber-btn-secondary {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    color: #64748b;
    border: 1px solid #334155;
    font-family: monospace;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.cyber-btn-secondary:hover {
    border-color: #94a3b8;
    color: #e2e8f0;
}

/* Memory Matrix Game */
.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #1e293b;
    border-radius: 0.5rem;
}

.matrix-header {
    color: #0ea5e9;
    font-family: monospace;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 1rem;
}

.matrix-node {
    width: 50px;
    height: 50px;
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s;
}

.matrix-node:hover {
    border-color: #0ea5e9;
}

.matrix-node.flash {
    background: #0ea5e9;
    box-shadow: 0 0 15px #0ea5e9;
    border-color: #0ea5e9;
}

.matrix-node.flash-player {
    background: #10b981;
    box-shadow: 0 0 15px #10b981;
    border-color: #10b981;
}

.matrix-status {
    font-family: monospace;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.1s ease-in-out 3;
}

/* Custom Modals */
.cyber-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.cyber-modal {
    background: #09090b;
    border: 1px solid #1e293b;
    padding: 2.5rem;
    border-radius: 0.5rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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