/* Navbar Enhancements */
.navbar {
    background: rgba(5, 5, 10, 0.6) !important;
    backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    padding: 1rem 0 !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.nav-link {
    font-weight: 600 !important;
    letter-spacing: 0.5px;
    padding: 8px 16px !important;
    border-radius: 8px;
    transition: all 0.3s ease !important;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary) !important;
    box-shadow: 0 0 15px rgba(0, 242, 234, 0.1);
}

.nav-link::after {
    display: none !important;
    /* Remove underline, use bg highlight instead */
}

/* Enhanced Dropdown */
.dropdown-menu {
    display: none;
    /* Hidden by default */
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #0a0a14;
    /* Darker solid background */
    padding: 10px;
    border-radius: 12px;
    margin-top: 15px;
    min-width: 260px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform-origin: top center;
    animation: dropdownSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-links li:hover .dropdown-menu {
    display: block;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-item {
    border-radius: 8px;
    margin-bottom: 4px;
    border: none !important;
    font-weight: 500;
}

.dropdown-item:hover {
    background: linear-gradient(90deg, rgba(0, 242, 234, 0.1), transparent);
    transform: translateX(5px);
}

/* Course Layout - Sidebar Style */
.course-layout-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    padding-top: 2rem;
    min-height: calc(100vh - 80px);
    /* Adjust based on footer/header */
}

.course-sidebar {
    position: sticky;
    top: 100px;
    height: calc(100vh - 140px);
    overflow-y: auto;
    padding-right: 1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Scrollbar for sidebar */
.course-sidebar::-webkit-scrollbar {
    width: 6px;
}

.course-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.course-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.course-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-nav {
    list-style: none;
    padding: 0;
}

.sidebar-link {
    display: block;
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2px;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    border-left: 2px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    padding-left: 20px;
}

.sidebar-link.active {
    background: rgba(0, 242, 234, 0.08);
    /* Primary dim */
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.course-content-area {
    padding-bottom: 4rem;
}

.lesson-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.lesson-section.active {
    display: block;
}

.lesson-header-main {
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.lesson-header-main h2 {
    font-size: 2rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.lesson-breadcrumb {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Example Box Styling */
.example-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.example-box pre {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    border-radius: 8px;
}

.example-box pre:last-child {
    margin-bottom: 0 !important;
}

.lesson-section h4 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* Code block enhancements */
pre {
    background: #0d1117 !important;
    border: 1px solid #30363d !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* SQL Compiler Layout */
.sql-compiler-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 15px;
    height: 350px;
    margin-bottom: 15px;
}

.db-explorer {
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
}

.db-explorer-title {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#db-tables {
    list-style: none;
    padding: 10px;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.table-item {
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: #aeaeae;
}

.table-item i {
    color: var(--primary);
    margin-right: 5px;
}

.column-list {
    margin-left: 20px;
    margin-top: 4px;
    font-size: 0.8rem;
    color: #666;
    border-left: 1px solid #333;
    padding-left: 8px;
}

/* SQL Output Table */
.sql-table-view {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    border-radius: 6px;
    overflow: hidden;
}

.sql-table-view th {
    background: rgba(0, 242, 234, 0.1);
    color: var(--primary);
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.sql-table-view td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #ccc;
}

/* Fix for Compiler Resize & Overlap */
.custom-editor-container {
    position: relative;
    overflow: visible !important;
    /* Allow controls to stay on top */
}

.custom-editor-container.floating {
    resize: both;
    overflow: auto !important;
    min-width: 400px;
    min-height: 400px;
    max-height: 90vh;
}

.compiler-header {
    background: #1a1a2e;
    position: sticky;
    top: 0;
    z-index: 10;
    margin-bottom: 10px !important;
}

.compiler-controls {
    z-index: 100;
}

.btn-float {
    z-index: 101;
    position: relative;
}

/* Ensure textarea doesn't handle resizing individually if container does */
.code-textarea {
    resize: none !important;
}

/* Responsive Overrides */
@media (max-width: 900px) {
    .course-layout-container {
        grid-template-columns: 1fr;
    }

    .course-sidebar {
        position: static;
        height: auto;
        max-height: 300px;
        margin-bottom: 2rem;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 1rem;
    }

    .sql-compiler-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .db-explorer {
        height: 200px;
    }
}