/* Global Styles */
:root {
    --primary-color: #0CA9C2;
    --secondary-color: #6c757d;
    --success-color: #60a917;
    --danger-color: #ce352c;
    --warning-color: #fa6800;
    --dark-color: #1d1d1d;
    --light-color: #f8f9fa;
}

body {
    background-color: #f5f7fa;
    min-height: 100vh;
}

/* Page Management */
.page {
    min-height: 100vh;
}

.page[style*="block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Admin Dashboard */
#admin-dashboard-page {
    background: #f5f7fa;
}

#admin-dashboard-page .container-fluid {
    max-width: 1600px;
    margin: 0 auto;
}

/* Custom Tabs */
.tabs-list {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    background: white;
    border-radius: 8px 8px 0 0;
    border: 1px solid #dee2e6;
    border-bottom: none;
    overflow: hidden;
}

.tabs-list li {
    flex: 0 0 auto;
}

.tabs-list li a {
    display: block;
    padding: 15px 25px;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tabs-list li a:hover {
    background: #f8f9fa;
    color: var(--primary-color);
}

.tabs-list li.active a {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: #f8f9fa;
}

.tabs-content {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
    padding: 25px;
    min-height: 400px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Gap utilities */
.gap1 { gap: 0.25rem; }
.gap2 { gap: 0.5rem; }
.gap3 { gap: 1rem; }

/* Login Page - Flat Design */
#login-page {
    display: flex;
    min-height: 100vh;
}

#login-page[style*="none"] {
    display: none !important;
}

.login-split {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    background: #0CA9C2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-branding {
    text-align: center;
    color: white;
}

.login-logo {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
}

.login-logo span {
    font-size: 48px;
}

.login-branding h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 10px;
    letter-spacing: -0.5px;
}

.login-branding p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

.login-right {
    flex: 1;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-form-container {
    width: 100%;
    max-width: 380px;
}

.login-form-container h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px;
}

.login-subtitle {
    color: #666;
    margin: 0 0 32px;
    font-size: 1rem;
}

.flat-input-group {
    margin-bottom: 20px;
}

.flat-input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.flat-input-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-sizing: border-box;
}

.flat-input-group input:focus {
    border-color: #0CA9C2;
    box-shadow: 0 0 0 3px rgba(12, 169, 194, 0.1);
}

.flat-input-group input::placeholder {
    color: #aaa;
}

.login-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c00;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.login-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: #0CA9C2;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.login-btn:hover {
    background: #0a95ab;
}

.login-btn:active {
    transform: scale(0.98);
}

.login-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    font-size: 0.85rem;
    color: #888;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}

.status-dot.connected {
    background: #60a917;
}

@media (max-width: 768px) {
    .login-split {
        flex-direction: column;
    }
    
    .login-left {
        padding: 40px 20px;
        flex: 0 0 auto;
    }
    
    .login-branding h1 {
        font-size: 1.8rem;
    }
    
    .login-logo {
        width: 70px;
        height: 70px;
        margin-bottom: 20px;
    }
    
    .login-logo span {
        font-size: 32px;
    }
    
    .login-right {
        flex: 1;
        padding: 30px 20px;
    }
}

/* Student Dashboard */
.assignment-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.assignment-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.assignment-card-header {
    background: linear-gradient(135deg, #0CA9C2 0%, #0078A8 100%);
    color: white;
    padding: 20px;
}

.assignment-card-body {
    padding: 20px;
}

.assignment-card-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-not_started { background-color: #6c757d; color: white; }
.status-in_progress { background-color: #fa6800; color: white; }
.status-submitted { background-color: #60a917; color: white; }
.status-force_submitted { background-color: #ce352c; color: white; }

/* Workspace */
#assignment-workspace-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

#assignment-workspace-page[style*="block"] {
    display: flex !important;
}

.workspace-header {
    flex-shrink: 0;
    background: linear-gradient(135deg, #0CA9C2 0%, #0078A8 100%);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.workspace-header h5 {
    margin: 0;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.workspace-header-left,
.workspace-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.timer-display {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 6px;
    color: white;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-display.warning {
    background: #fa6800;
    animation: pulse 1s infinite;
}

.timer-display.danger {
    background: #ce352c;
    animation: pulse 0.5s infinite;
}

.submit-btn {
    background: #60a917;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: #4e8a13;
}

.toggle-panel-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    color: #666;
}

.toggle-panel-btn:hover {
    background: #eee;
}

.workspace-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.task-panel {
    width: 350px;
    min-width: 350px;
    max-width: 350px;
    background: white;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    transition: width 0.3s, min-width 0.3s, max-width 0.3s;
    flex-shrink: 0;
}

.task-panel.collapsed {
    width: 0;
    min-width: 0;
    max-width: 0;
    overflow: hidden;
}

.task-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.task-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.task-content h1 { font-size: 1.5rem; margin-top: 0; }
.task-content h2 { font-size: 1.25rem; }
.task-content h3 { font-size: 1.1rem; }
.task-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
}
.task-content code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.task-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#monaco-editor {
    flex: 1;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Tables */
.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Review Modal */
.review-sidebar {
    background: #fafafa;
}

#submission-info .info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

#submission-info .info-row:last-child {
    border-bottom: none;
}

#control-events-list .event-item {
    padding: 8px;
    border-left: 3px solid #fa6800;
    margin-bottom: 8px;
    background: #fff8e1;
    border-radius: 0 4px 4px 0;
}

.review-toolbar .button-group .button.active {
    background-color: var(--primary-color);
    color: white;
}

/* Assign users list */
.assign-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.assign-user-item:last-child {
    border-bottom: none;
}

.assign-user-item:hover {
    background: #f8f9fa;
}

.user-info-text {
    display: flex;
    flex-direction: column;
}

.user-info-text .username {
    font-weight: 500;
}

.user-info-text .email {
    font-size: 0.85em;
    color: #888;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsive */
@media (max-width: 768px) {
    .task-panel {
        width: 100%;
        min-width: 100%;
        position: absolute;
        z-index: 100;
        height: calc(100% - 50px);
    }
    
    .task-panel.collapsed {
        display: none;
    }
    
    .workspace-container {
        position: relative;
    }
}

/* Fix navbar padding for content */
.pt-8 {
    padding-top: 80px !important;
}

/* Navbar styling */
#main-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #0CA9C2 0%, #0078A8 100%);
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

#main-navbar[style*="block"] {
    display: flex !important;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.navbar-brand .icon {
    font-size: 1.6rem;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-item {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.navbar-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

#logout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#logout-btn:hover {
    background: rgba(206, 53, 44, 0.9);
    border-color: transparent;
}

/* Dialog fixes */
.dialog.h-vh-100 {
    height: 100vh !important;
    max-height: 100vh !important;
}

.dialog.h-vh-100 .dialog-content {
    max-height: none !important;
}

/* ================================
   Console & Code Execution Styles
   ================================ */

/* Console Panel */
.console-panel {
    background: #1e1e1e;
    border-top: 1px solid #333;
    display: flex;
    flex-direction: column;
    height: 200px;
    min-height: 100px;
    max-height: 50vh;
    flex-shrink: 0;
}

.console-panel.expanded {
    height: 50vh;
}

.console-panel.collapsed {
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    overflow: hidden;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #252526;
    border-bottom: 1px solid #333;
    color: #cccccc;
    font-size: 0.85rem;
    user-select: none;
}

.console-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.console-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.console-title .icon {
    font-size: 1rem;
}

/* Language selector in console */
.language-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.language-selector-wrapper label {
    font-size: 0.8rem;
    color: #888;
}

/* Language display (forced by assignment) */
.language-display {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #3c3c3c;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #4ec9b0;
}

.language-display .icon {
    font-size: 0.9rem;
}

#language-selector {
    background: #3c3c3c;
    border: 1px solid #555;
    border-radius: 4px;
    color: #ccc;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

#language-selector:hover {
    border-color: #0CA9C2;
}

#language-selector:focus {
    outline: none;
    border-color: #0CA9C2;
}

/* Console buttons */
.console-btn {
    background: #3c3c3c;
    border: 1px solid #555;
    color: #ccc;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.console-btn:hover {
    background: #4a4a4a;
    border-color: #666;
}

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

.console-btn.primary {
    background: #0CA9C2;
    border-color: #0CA9C2;
    color: white;
}

.console-btn.primary:hover:not(:disabled) {
    background: #0a95ab;
}

.console-btn.danger {
    background: #ce352c;
    border-color: #ce352c;
    color: white;
}

.console-btn.danger:hover:not(:disabled) {
    background: #b52e26;
}

/* Console output area */
#console-output {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: #1e1e1e;
}

/* Console output types */
.console-stdout {
    color: #d4d4d4;
}

.console-stderr {
    color: #f48771;
}

.console-stdin {
    color: #9cdcfe;
    font-style: italic;
}

.console-info {
    color: #6a9955;
}

.console-warning {
    color: #dcdcaa;
}

.console-error {
    color: #f48771;
    font-weight: bold;
}

/* Console input area */
#console-input-container {
    display: none;
    padding: 8px 12px;
    background: #252526;
    border-top: 1px solid #333;
    align-items: center;
    gap: 8px;
}

#console-input-container.visible {
    display: flex;
}

.console-input-label {
    color: #9cdcfe;
    font-size: 0.85rem;
    font-family: 'Consolas', 'Monaco', monospace;
}

#console-input {
    flex: 1;
    background: #3c3c3c;
    border: 1px solid #555;
    border-radius: 4px;
    color: #d4d4d4;
    padding: 6px 10px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

#console-input:focus {
    outline: none;
    border-color: #0CA9C2;
}

#console-input::placeholder {
    color: #666;
}

/* Execution toolbar */
.execution-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #252526;
    border-bottom: 1px solid #333;
}

/* Resize handle for console */
.console-resize-handle {
    height: 4px;
    background: #333;
    cursor: ns-resize;
    transition: background 0.2s;
}

.console-resize-handle:hover {
    background: #0CA9C2;
}

/* Editor panel with console */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.editor-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

/* Monaco editor area when console is present */
#monaco-editor {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
}

/* Animation for spinner */
.ani-spin {
    animation: spin 1s linear infinite;
}

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

/* Diagnostics markers (shown in gutter) */
.monaco-editor .squiggly-error {
    background: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%206%203'%20enable-background%3D'new%200%200%206%203'%20height%3D'3'%20width%3D'6'%3E%3Cg%20fill%3D'%23f48771'%3E%3Cpolygon%20points%3D'5.5%2C0%202.5%2C3%201.1%2C3%204.1%2C0'%2F%3E%3Cpolygon%20points%3D'4%2C0%206%2C2%206%2C0.6%205.4%2C0'%2F%3E%3Cpolygon%20points%3D'0%2C2%201%2C3%202.4%2C3%200%2C0.6'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") repeat-x bottom left;
}

.monaco-editor .squiggly-warning {
    background: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%206%203'%20enable-background%3D'new%200%200%206%203'%20height%3D'3'%20width%3D'6'%3E%3Cg%20fill%3D'%23dcdcaa'%3E%3Cpolygon%20points%3D'5.5%2C0%202.5%2C3%201.1%2C3%204.1%2C0'%2F%3E%3Cpolygon%20points%3D'4%2C0%206%2C2%206%2C0.6%205.4%2C0'%2F%3E%3Cpolygon%20points%3D'0%2C2%201%2C3%202.4%2C3%200%2C0.6'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") repeat-x bottom left;
}

/* Status indicator */
.execution-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #888;
}

.execution-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
}

.execution-status .status-dot.running {
    background: #4ec9b0;
    animation: pulse 1s infinite;
}

.execution-status .status-dot.error {
    background: #f48771;
}

.execution-status .status-dot.success {
    background: #6a9955;
}

