/**
 * PyLearn Academy - Custom Styling & Dashboard Theme
 */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #475569;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --dark-bg: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: #ffffff;
    --body-bg: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --sidebar-width: 260px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Impersonation Banner */
.impersonation-banner {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    color: #ffffff;
    font-weight: 600;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1050;
}

/* App Wrapper & Sidebars */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #e2e8f0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 1000;
}

.app-sidebar .sidebar-brand {
    padding: 20px 24px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.app-sidebar .sidebar-nav {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.app-sidebar .nav-link {
    color: #94a3b8;
    padding: 10px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.app-sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

.app-sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-heading {
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 16px 8px;
}

.app-sidebar .sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Main Content Area */
.app-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

.app-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
}

.content-container {
    padding: 24px;
    flex-grow: 1;
}

/* Cards & Widgets */
.stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
}

/* Code Lab & Editor Styles */
.editor-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background-color: #1e1e1e;
}

.editor-toolbar {
    background-color: #2d3748;
    color: #e2e8f0;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #4a5568;
    flex-wrap: wrap;
    gap: 8px;
}

.terminal-window {
    background-color: #0f172a;
    color: #38bdf8;
    font-family: 'Consolas', 'Courier New', monospace;
    padding: 16px;
    border-radius: 8px;
    min-height: 180px;
    max-height: 360px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 1px solid #1e293b;
}

.terminal-window.error {
    color: #f87171;
}

.terminal-header {
    background-color: #1e293b;
    color: #94a3b8;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* CodeMirror customizations */
.CodeMirror {
    height: 420px !important;
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

/* Review Mode & Line Comments */
.code-review-line {
    position: relative;
    padding: 2px 4px;
    display: flex;
}

.code-review-line:hover .line-comment-btn {
    opacity: 1;
}

.line-comment-btn {
    opacity: 0;
    position: absolute;
    right: 8px;
    top: 2px;
    transition: opacity 0.2s ease;
}

.comment-bubble {
    background-color: #eff6ff;
    border-left: 4px solid var(--primary-color);
    padding: 10px 14px;
    margin: 8px 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
}

/* Notification Bell Dropdown */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 999px;
}

.notification-dropdown {
    width: 320px;
    max-height: 380px;
    overflow-y: auto;
}

/* Responsive Sidebar Toggle */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
    }
    .app-sidebar.show {
        left: 0;
    }
    .content-container {
        padding: 16px;
    }
}

/* Assignment Countdown Badges & Animations */
.assignment-countdown {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    transition: all 0.25s ease-in-out;
}

@keyframes pulse-urgent-anim {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.6);
    }
    70% {
        transform: scale(1.03);
        box-shadow: 0 0 0 6px rgba(220, 53, 69, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

.pulse-urgent {
    animation: pulse-urgent-anim 2s infinite ease-in-out;
    background-color: #dc3545 !important;
    color: #ffffff !important;
    font-weight: 700;
}

/* Interactive Input & Stdin Drawer Styles */
.terminal-stdin-drawer {
    border-left: 3px solid var(--info-color);
    background-color: #0b1120 !important;
    animation: fadeInDrawer 0.2s ease;
}

@keyframes fadeInDrawer {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.terminal-stdin-drawer textarea {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
    border-color: #334155;
}

.terminal-stdin-drawer textarea:focus {
    background-color: #020617 !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.terminal-user-input {
    color: #4ade80 !important;
    font-weight: 600;
    text-shadow: 0 0 2px rgba(74, 222, 128, 0.4);
    padding: 0 2px;
}

#interactiveInputModal .modal-content {
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

#interactiveInputModal .prompt-input-val:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Multi-line Truncation Utilities */
.text-truncate-1, .line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-truncate-2, .line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-truncate-3, .line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Expandable Assignment Table Rows */
.expand-row-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
}

.expand-row-btn:hover {
    background-color: #e2e8f0;
    color: var(--primary-color);
}

.expand-row-btn i {
    transition: transform 0.25s ease-in-out;
}

.expand-row-btn[aria-expanded="true"] i,
.expand-row-btn.active i {
    transform: rotate(90deg);
}

.assignment-expanded-card {
    border-left: 4px solid var(--primary-color) !important;
    background-color: #f8fafc;
}

.cursor-pointer {
    cursor: pointer;
}
