/**
 * CodeMastery Pro Custom Styles
 *
 * @package CodeMastery Pro
 * @version 2.0.0
 */

/* ================================
   SIDEBAR STYLES
   ================================ */
.tutorial-sidebar {
    position: fixed;
    left: 0;
    top: 120px;
    width: 280px;
    height: calc(100vh - 120px);
    background: var(--cm-darker);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition-normal);
}

.sidebar-toggle {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: var(--cm-darker);
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--cm-light);
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
}

.sidebar-content {
    padding: 20px;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(241, 241, 241, 0.5);
    margin-bottom: 15px;
}

/* Language Selector */
.language-selector {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.language-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    transition: var(--transition-fast);
}

.language-item:hover,
.language-item.active {
    background: rgba(4, 170, 109, 0.1);
}

.language-item.active {
    border-left: 3px solid var(--cm-green);
}

.language-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.language-name {
    color: var(--cm-light);
    font-size: 0.9rem;
}

.language-item:hover .language-name,
.language-item.active .language-name {
    color: var(--cm-green);
}

/* Topic Navigation */
.topic-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topic-list li {
    border-radius: 6px;
    transition: var(--transition-fast);
}

.topic-list li:hover {
    background: rgba(255, 255, 255, 0.03);
}

.topic-list li.current {
    background: rgba(4, 170, 109, 0.1);
}

.topic-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: rgba(241, 241, 241, 0.7);
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.topic-list li.current a {
    color: var(--cm-green);
}

.topic-list a:hover {
    color: var(--cm-green);
}

/* Quick Links */
.quick-links {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.quick-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: rgba(241, 241, 241, 0.7);
    font-size: 0.9rem;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.quick-links a:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--cm-green);
}

.quick-links svg {
    color: var(--cm-green);
}

/* Progress Tracker */
.progress-tracker {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 10px;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--cm-green);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: rgba(241, 241, 241, 0.6);
    text-align: center;
}

/* ================================
   FILTER BAR
   ================================ */
.filter-bar {
    background: var(--cm-darker);
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-bar-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    color: rgba(241, 241, 241, 0.6);
    font-size: 0.9rem;
}

.filter-group select {
    padding: 10px 15px;
    background: var(--cm-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--cm-light);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 150px;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--cm-green);
}

.filter-search {
    margin-left: auto;
}

.filter-search form {
    display: flex;
    position: relative;
}

.filter-search input {
    padding: 10px 45px 10px 15px;
    background: var(--cm-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--cm-light);
    font-size: 0.9rem;
    width: 250px;
}

.filter-search input:focus {
    outline: none;
    border-color: var(--cm-green);
}

.filter-search button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: rgba(241, 241, 241, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-search button:hover {
    color: var(--cm-green);
}

/* ================================
   ARCHIVE CONTENT
   ================================ */
.archive-content {
    padding: 40px 0;
    background: var(--cm-dark);
}

.pagination-wrapper {
    margin-top: 50px;
    display: flex;
    justify-content: center;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results h3 {
    color: var(--cm-white);
    margin-bottom: 10px;
}

.no-results p {
    color: rgba(241, 241, 241, 0.6);
    margin-bottom: 25px;
}

/* ================================
   PLAYGROUND STYLES
   ================================ */
.playground-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--cm-darker);
    border-radius: 12px 12px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-select {
    padding: 8px 15px;
    background: var(--cm-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--cm-light);
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: rgba(241, 241, 241, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--cm-green);
}

.editor-tabs {
    display: flex;
    gap: 5px;
}

.editor-tab {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: rgba(241, 241, 241, 0.5);
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.editor-tab:hover {
    color: var(--cm-light);
}

.editor-tab.active {
    background: rgba(4, 170, 109, 0.2);
    color: var(--cm-green);
}

.playground-console {
    margin-top: 20px;
    background: #1e1e1e;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #2d2d2d;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.console-header span {
    font-size: 0.8rem;
    color: rgba(241, 241, 241, 0.6);
    font-weight: 500;
}

.console-output {
    padding: 15px;
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.console-line {
    padding: 4px 0;
    color: #d4d4d4;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--cm-darker);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h3 {
    color: var(--cm-white);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    color: rgba(241, 241, 241, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 99, 71, 0.2);
    color: #ff6347;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.example-card {
    padding: 20px;
    background: var(--cm-dark);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: var(--transition-normal);
}

.example-card:hover {
    border-color: var(--cm-green);
    transform: translateY(-3px);
}

.example-card h4 {
    color: var(--cm-white);
    margin-bottom: 8px;
    font-size: 1rem;
}

.example-card p {
    color: rgba(241, 241, 241, 0.5);
    font-size: 0.85rem;
    margin: 0;
}

/* ================================
   AUTH PAGES
   ================================ */
.auth-error {
    background: rgba(255, 99, 71, 0.1);
    border: 1px solid rgba(255, 99, 71, 0.3);
    color: #ff6347;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.auth-success {
    background: rgba(4, 170, 109, 0.1);
    border: 1px solid rgba(4, 170, 109, 0.3);
    color: var(--cm-green);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* ================================
   RESPONSIVE SIDEBAR
   ================================ */
@media (max-width: 1024px) {
    .tutorial-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        top: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .sidebar-content {
        display: none;
        padding: 20px;
    }
    
    .sidebar-content.active {
        display: block;
    }
    
    .single-content-with-sidebar {
        margin-left: 0 !important;
    }
}

@media (max-width: 768px) {
    .filter-bar-inner {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-search {
        margin-left: 0;
    }
    
    .filter-search input {
        width: 100%;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .playground-toolbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* ================================
   COURSE IMAGE PLACEHOLDER
   ================================ */
.course-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================================
   PAGINATION STYLES
   ================================ */
.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-links a,
.nav-links span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
    border-radius: 10px;
    background: var(--cm-darker);
    color: var(--cm-light);
    font-weight: 600;
    transition: var(--transition-fast);
}

.nav-links a:hover {
    background: var(--cm-green);
    color: var(--cm-white);
}

.nav-links .current {
    background: var(--cm-green);
    color: var(--cm-white);
}

.nav-links .prev,
.nav-links .next {
    padding: 0 15px;
}

.nav-links .disabled {
    opacity: 0.5;
    pointer-events: none;
}
