/* style.css - Styles for the Python Exam Web Interface */

/* --- START: Color Theme Variables --- */
:root {
    --primary-color: #002B5B; /* School Navy Blue */
    --primary-hover: #003F88;
    --highlight-bg: #E6F0FF;
    --highlight-border: #B3D1FF;
    --highlight-text: #002B5B;
    --success-color: #31a24c;
    --danger-color: #fa383e;
    --secondary-bg: #e4e6eb;
    --secondary-text: #4b4f56;
    --secondary-hover: #d8dbdf;
}
/* --- END: Color Theme Variables --- */


/* --- General Body & Font Styles --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding-top: 70px; /* Global padding for fixed header */
    display: flex;
    justify-content: center;
}

/* --- Login Container --- */
.login-container {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
    align-self: center;
    margin-top: 40px; /* Counteract body padding to center vertically */
}

.login-container h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 24px;
    color: #1c1e21;
}

.login-container p {
    margin-bottom: 20px;
    font-size: 16px;
    color: #606770;
}

.teacher-link {
    display: block;
    margin-top: 20px;
    color: #927D31;
    text-decoration: none;
}
.teacher-link:hover {
    text-decoration: underline;
}

/* --- Form Group Styling --- */
.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #4b4f56;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--highlight-bg);
}

.form-group button,
.action-btn,
.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-sizing: border-box;
}

.form-group button:hover,
.action-btn:hover,
.btn-primary:hover {
    background-color: var(--primary-hover);
}

/* --- Error & Success Message Styling --- */
.message {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    text-align: center;
}
.error-message {
    background-color: #fbe2e2;
    color: #8a1717;
    border: 1px solid #e0b1b1;
}
.success-message {
    background-color: var(--highlight-bg);
    color: var(--highlight-text);
    border: 1px solid var(--highlight-border);
}

/* --- Header --- */
.header {
    background-color: #ffffff;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 100;
}

.header h1 {
    margin: 0;
    font-size: 22px;
    color: #1c1e21;
}

.header-link {
    text-decoration: none;
    color: inherit;
}
.header-link:hover {
    text-decoration: underline;
}

.user-info {
    display: flex;
    align-items: center;
}

.user-info span {
    margin-right: 15px;
    font-weight: 600;
    color: var(--secondary-text);
}

.logout-btn {
    background-color: var(--secondary-bg);
    color: var(--secondary-text);
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.2s;
}

.logout-btn:hover {
    background-color: var(--secondary-hover);
}

/* --- Main Content Containers --- */
.main-container, .problem-container {
    margin: 20px;
    padding: 30px;
    width: 100%;
    max-width: 900px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.problem-container {
    max-width: 1200px; /* Wider for code editor */
}

.main-container h2 {
    margin-top: 0;
    border-bottom: 1px solid #dddfe2;
    padding-bottom: 10px;
}

/* --- Table Styling (Used across dashboards) --- */
.problem-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}

.problem-table th, .problem-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #dddfe2;
}

.problem-table th {
    background-color: #f0f2f5;
    font-weight: 600;
}

.problem-table tbody tr:hover {
    background-color: #f9f9f9;
}

.problem-table td a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
}

.problem-table td a:hover {
    text-decoration: underline;
}

.problem-table tr.solved {
    background-color: var(--highlight-bg);
}

.problem-table tr.solved td a {
    color: var(--primary-hover);
}

.problem-table tr.solved td:last-child {
    color: var(--success-color);
    font-weight: bold;
}

/* --- Problem Page Specifics --- */
.problem-description {
    border-bottom: 1px solid #dddfe2;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.problem-description p {
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.example-box {
    background-color: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}
.example-box h4 {
    margin-top: 0;
}
.example-box pre {
    background-color: #ffffff;
    padding: 10px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* --- Code Editor & Output --- */
.code-editor-area {
    margin-bottom: 20px;
}

.CodeMirror {
    border: 1px solid #dddfe2;
    border-radius: 6px;
    height: 400px;
    font-size: 16px;
}

.code-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
#run-code-btn {
    padding: 10px 20px;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    width: auto;
}
#run-code-btn:hover {
    background-color: #2b8a3e;
}
.reset-form button {
    width: auto; /* Override default button width */
}

.result-box {
    margin-top: 20px;
    background-color: #f0f2f5;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    padding: 15px;
    min-height: 100px;
    transition: all 0.3s ease;
}

.result-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
}

.result-box.running { border-color: var(--primary-color); }
.result-box.correct { background-color: var(--highlight-bg); border-color: var(--primary-color); color: var(--highlight-text); }
.result-box.incorrect { background-color: #fbe2e2; border-color: #e0b1b1; color: #8a1717; }

/* --- Teacher & Admin Dashboards --- */
.teacher-actions, .dashboard-controls, .student-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #dddfe2;
    padding-bottom: 20px;
}
.teacher-actions h2, .dashboard-controls h2, .student-view-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}
.teacher-actions div {
    display: flex;
    gap: 10px;
}
.action-btn, .btn-primary, .btn-secondary, .btn-action {
    width: auto;
    font-size: 16px;
    padding: 10px 20px;
    text-decoration: none;
    text-align: center;
    display: inline-block;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    border: 1px solid transparent;
}
.btn-secondary {
    background-color: var(--secondary-bg);
    color: var(--secondary-text);
    border-color: #ccc;
}
.btn-secondary:hover {
    background-color: var(--secondary-hover);
}


.class-selector-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.class-selector-form select {
    flex-grow: 1;
    padding: 10px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #dddfe2;
}

.class-selector-form button {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.class-selector-form button:hover {
    background-color: var(--primary-hover);
}

.student-progress-container {
    margin-top: 30px;
    border-top: 1px solid #dddfe2;
    padding-top: 20px;
}

/* --- Student Submission View Styling --- */
.submission-box {
    background-color: #f5f7fa;
    border: 1px solid #dcdfe3;
    border-radius: 8px;
    margin-bottom: 25px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s ease-in-out;
}
.submission-box:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.submission-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #1c1e21;
    border-bottom: 1px solid #dcdfe3;
    padding-bottom: 10px;
}
.submission-box pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    border-radius: 6px;
    padding: 15px;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', Courier, monospace;
    font-size: 15px;
}

/* --- Deletion Confirmation Page --- */
.confirmation-form {
    margin-top: 20px;
}
.confirmation-form .form-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}
.confirmation-form .btn-secondary,
.confirmation-form .btn-danger {
    width: auto;
    font-size: 16px;
    font-weight: bold;
    padding: 12px 25px;
}

/* START: New Delete Button Styles */
.btn-danger {
    background-color: #fff;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}
.btn-danger:hover {
    background-color: var(--danger-color);
    color: #fff;
}
/* END: New Delete Button Styles */

.confirmation-form .btn-secondary {
    background-color: var(--secondary-bg);
    color: var(--secondary-text);
}
.confirmation-from .btn-secondary:hover {
    background-color: var(--secondary-hover);
}


/* --- Student Dashboard Info Box --- */
.info-box {
    background-color: var(--highlight-bg);
    border-left: 5px solid var(--primary-color);
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 0 8px 8px 0;
}
.info-box h2 {
    margin-top: 0;
    color: var(--primary-hover);
    border-bottom: none;
    padding-bottom: 0;
}
.info-box p {
    line-height: 1.6;
    margin-bottom: 10px;
}
.warning-box {
    background-color: #fff0f0;
    border: 1px solid #e0b1b1;
    color: #8a1717;
    padding: 1px 15px;
    border-radius: 6px;
    font-weight: 500;
}
.warning-box strong {
    font-weight: 700;
}

/* --- Progress Bar --- */
.progress-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #dddfe2;
}
.progress-section h2 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 15px;
}
.progress-bar-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    color: #606770;
    font-weight: 500;
    padding: 0 5px;
}
.progress-bar-container {
    width: 100%;
    height: 25px; 
    background-color: var(--secondary-bg);
    border-radius: 12.5px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary-color); /* Blue fill color */
    border-radius: 12.5px;
    transition: width 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
}

/* --- Login Lockout Section --- */
.login-lockout-section {
    background-color: #f9f9f9;
    border: 1px solid #dddfe2;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.login-lockout-section h2 {
    margin: 0;
    border: none;
    padding: 0;
    font-size: 18px;
}
.lockout-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}
.status-badge {
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    color: white;
    text-transform: uppercase;
    font-size: 14px;
}
.status-enabled {
    background-color: var(--success-color);
}
.status-disabled {
    background-color: var(--danger-color);
}
.login-lockout-section button {
    width: auto;
    font-size: 16px;
    padding: 10px 20px;
}

/* --- Toggle Switch Styles --- */
.toggle-form {
    display: flex;
    justify-content: center;
    align-items: center;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--danger-color); /* Red for 'off'/'locked' */
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--success-color); /* Green for 'on'/'unlocked' */
}
input:checked + .slider:before {
    transform: translateX(26px);
}

/* --- Admin Panel Styles --- */
.test-case-box {
    border: 1px solid #ccd0d5;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    position: relative;
}

/* START: New Remove Button Styles */
.remove-test-case {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #fff;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}
.remove-test-case:hover {
    background-color: var(--danger-color);
    color: #fff;
}
/* END: New Remove Button Styles */

