/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Great+Vibes&display=swap');

/* Variables - Default (Light Mode) */
:root {
    --primary-color: #4e54c8;
    --secondary-color: #8f94fb;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --nav-bg: rgba(255, 255, 255, 0.85);
    --footer-bg: #1a1a2e;
    
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    
    --border-radius: 12px;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --primary-color: #6c72e6;
    --secondary-color: #a8adfc;
    --bg-color: #121212;
    --card-bg: #1e1e24;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #333333;
    --nav-bg: rgba(30, 30, 36, 0.9);
    --footer-bg: #0a0a14;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Base Styles */
body {
    font-family: Arial, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-color);
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}
a:hover {
    color: var(--secondary-color);
}

/* Utility Classes */
.card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

.bg-light, .bg-white {
    background-color: var(--card-bg) !important;
}

.text-dark {
    color: var(--text-main) !important;
}

.border {
    border-color: var(--border-color) !important;
}

.gradient-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    color: white !important;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(78, 84, 200, 0.3);
}

.gradient-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(78, 84, 200, 0.4);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Navbar */
.user-navbar {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    padding: 15px 0;
    transition: var(--transition);
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: var(--text-main);
    padding: 10px 15px;
    position: relative;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15px;
    right: 15px;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    transform: scaleX(1);
}

/* Dark Mode Toggle Switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}
.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}
.theme-switch input {
    display: none;
}
.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--primary-color);
}
input:checked + .slider:before {
    transform: translateX(26px);
}
.slider .icon {
    color: #fff;
    position: absolute;
    top: 8px;
    font-size: 14px;
}
.slider .sun { left: 8px; }
.slider .moon { right: 8px; }

/* Course Cards */
.course-card {
    border-radius: var(--border-radius);
    padding: 30px;
    transition: var(--transition);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
    border-top: 4px solid transparent;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.course-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    font-size: 28px;
    margin-bottom: 20px;
    color: white;
}

/* W3Schools style split editor */
.try-it-editor {
    display: flex;
    flex-direction: column;
    height: 500px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-top: 30px;
    background: var(--card-bg);
}
@media (min-width: 992px) {
    .try-it-editor {
        flex-direction: row;
    }
}
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff; /* Always white for iframe preview */
}
.editor-header {
    background: rgba(0,0,0,0.05);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}
.editor-textarea {
    flex: 1;
    width: 100%;
    resize: none;
    padding: 15px;
    font-family: monospace;
    font-size: 14px;
    border: none;
    background: var(--card-bg);
    color: var(--text-main);
    outline: none;
}
.preview-iframe {
    flex: 1;
    width: 100%;
    border: none;
}

/* Sidebar Topics */
.topic-sidebar {
    height: calc(100vh - 80px);
    overflow-y: auto;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
}
.topic-link {
    color: var(--text-main);
    padding: 10px 15px;
    display: block;
    border-left: 3px solid transparent;
    transition: var(--transition);
}
.topic-link:hover {
    background: rgba(0,0,0,0.05);
    color: var(--primary-color);
}
.topic-link.active {
    background: rgba(78, 84, 200, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: bold;
}

/* Certificate */
.certificate-preview {
    padding: 40px;
    position: relative;
    background: white;
    text-align: center;
    border: 15px solid #eaeaea;
}
.cert-name {
    font-family: 'Great Vibes', cursive;
    font-size: 3.5rem;
    color: var(--text-main);
    border-bottom: 2px solid #ccc;
    display: inline-block;
    padding: 0 40px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Courses Sub-Navbar */
.courses-subnavbar {
    position: fixed;
    top: 74px; /* Align right under the user-navbar */
    left: 0;
    right: 0;
    z-index: 1020; /* Just below main navbar z-index */
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    padding: 8px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.courses-subnavbar.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.subnav-link {
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.01);
    text-decoration: none;
}

.subnav-link i {
    font-size: 1rem;
    transition: var(--transition);
}

.subnav-link:hover {
    color: var(--course-color) !important;
    background-color: rgba(0, 0, 0, 0.02);
    border-color: var(--course-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.02);
}

/* For dark mode active state */
[data-theme="dark"] .subnav-link {
    background: rgba(255, 255, 255, 0.02);
}
[data-theme="dark"] .subnav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Scrollbar hiding for clean layout */
.courses-subnavbar .overflow-x-auto {
    scrollbar-width: none; /* Firefox */
}
.courses-subnavbar .overflow-x-auto::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

/* Footer Links hover effect */
.footer-link {
    transition: color 0.25s ease, padding-left 0.25s ease;
    display: inline-block;
}
.footer-link:hover {
    color: #ffffff !important;
    padding-left: 4px;
}
