:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #F9FAFB;
    --surface-color: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --success-bg: #DEF7EC;
    --success-text: #03543F;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 700px;
    background-color: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #312E81 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 0.95rem;
    opacity: 0.9;
}

main {
    padding: 2rem;
}

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

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

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

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

input[type="text"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: #fff;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.help-text {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

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

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

.btn-primary:disabled {
    background-color: #9CA3AF;
    cursor: not-allowed;
}

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

.btn-secondary:hover {
    background-color: #E5E7EB;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: #F9FAFB;
    border-color: #D1D5DB;
}

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

.code-area {
    font-family: 'Courier New', Courier, monospace;
    min-height: 250px;
    resize: vertical;
    background-color: #1E1E1E;
    color: #D4D4D4;
    border: none;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.code-area:focus {
    box-shadow: 0 0 0 3px rgba(30, 30, 30, 0.2);
}

.code-area.readonly {
    background-color: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: default;
}

.output-container {
    margin-top: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #374151;
    animation: fadeIn 0.3s ease-in-out;
}

.output-header {
    background-color: #374151;
    color: #9CA3AF;
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.terminal {
    background-color: #111827;
    color: #10B981; /* Default success color */
    padding: 1rem;
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.terminal.error {
    color: #EF4444; /* Error color */
}

.header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.header-info h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.student-badge {
    background-color: #EEF2FF;
    color: var(--primary-color);
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.actions .btn {
    flex: 1;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #BCF0DA;
}

.mt-4 {
    margin-top: 1rem;
}

.timestamp {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

#loading {
    text-align: center;
    padding: 3rem 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
