/* Stark Knowledge - Custom Styles */

/* General */
body {
    background-color: #f8f9fa;
}

/* Cards */
.subject-card,
.topic-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

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

/* Disabled Topics */
.topic-card.topic-disabled {
    opacity: 0.5;
}

/* Work Items */
.work-item.completed {
    opacity: 0.7;
    background-color: #f8f9fa;
}

.work-item.completed .card-title {
    text-decoration: line-through;
}

.completion-checkbox {
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
}

/* Notes Section */
.notes-editor {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.notes-editor.show {
    max-height: 500px;
}

.notes-editor:not(.d-none) {
    max-height: none;
}

.notes-textarea {
    resize: vertical;
    min-height: 80px;
}

.notes-status {
    display: block;
    margin-top: 0.25rem;
}

.notes-status.saving {
    color: #6c757d;
}

.notes-status.saved {
    color: #198754;
}

.notes-status.error {
    color: #dc3545;
}

/* Schedule Picker */
.schedule-picker {
    max-width: 200px;
}

.schedule-date {
    cursor: pointer;
}

/* Calendar */
.calendar-container {
    overflow-x: auto;
}

.calendar-table {
    min-width: 700px;
    table-layout: fixed;
}

.calendar-table th {
    text-align: center;
    font-weight: 600;
}

.calendar-day {
    height: 120px;
    vertical-align: top;
    padding: 0.5rem;
}

.calendar-day.today {
    background-color: #e7f5ff;
}

.day-number {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.calendar-day.today .day-number {
    color: #0d6efd;
}

.day-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-item {
    display: block;
    padding: 2px 4px;
    background-color: #e9ecef;
    border-radius: 3px;
    font-size: 0.75rem;
    text-decoration: none;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-item:hover {
    background-color: #dee2e6;
}

.calendar-item.completed {
    background-color: #d1e7dd;
    color: #0f5132;
}

/* Progress Bar */
.progress-bar {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Breadcrumb */
.breadcrumb {
    background-color: transparent;
    padding: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .calendar-day {
        height: 100px;
        padding: 0.25rem;
    }

    .calendar-item {
        font-size: 0.65rem;
    }

    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    .work-item .d-flex {
        flex-direction: column;
    }

    .work-item .ms-2 {
        margin-left: 0 !important;
        margin-top: 0.5rem;
    }
}

@media (max-width: 576px) {
    .calendar-table th {
        font-size: 0.75rem;
    }

    .day-number {
        font-size: 0.85rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .btn-group {
        flex-wrap: wrap;
    }
}

/* Navbar active state */
.nav-link.active {
    font-weight: 600;
}

/* Form improvements */
.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Button group styling */
.btn-group .btn.active {
    font-weight: 600;
}

/* Markdown content in descriptions */
.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 0.25rem;
    padding-left: 1.5rem;
}

.markdown-content code {
    background-color: #e9ecef;
    padding: 0.125rem 0.25rem;
    border-radius: 0.2rem;
    font-size: 0.875em;
}

.markdown-content pre {
    background-color: #e9ecef;
    padding: 0.5rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin-bottom: 0.25rem;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-content a {
    color: #0d6efd;
    text-decoration: underline;
}

.markdown-content a:hover {
    color: #0a58ca;
}

/* Transcript page */
.transcript-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.transcript-pane,
.notes-pane {
    flex: 1;
    overflow-y: scroll;
    padding: 1rem;
    min-height: 0;
    scrollbar-width: thin;
}

/* Force scrollbar always visible on WebKit/Blink (Safari, Chrome, etc.) */
.transcript-pane::-webkit-scrollbar,
.notes-pane::-webkit-scrollbar {
    width: 8px;
    -webkit-appearance: none;
}

.transcript-pane::-webkit-scrollbar-thumb,
.notes-pane::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.transcript-pane::-webkit-scrollbar-track,
.notes-pane::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.05);
}

.transcript-pane {
    border-bottom: 2px solid #dee2e6;
}

/* Always-visible scrollbar for notes textarea */
.notes-pane .notes-textarea {
    overflow-y: scroll;
    scrollbar-width: thin;
}

.notes-pane .notes-textarea::-webkit-scrollbar {
    width: 8px;
    -webkit-appearance: none;
}

.notes-pane .notes-textarea::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.notes-pane .notes-textarea::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.05);
}

.transcript-highlight {
    background-color: #f0f0f0;
    border-radius: 0.25rem;
}

.transcript-toolbar {
    display: none;
}

/* Custom scroll indicator (created by JS for mobile) */
.scroll-indicator {
    position: fixed;
    width: 5px;
    pointer-events: none;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
}

.scroll-indicator-thumb {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 3px;
    position: absolute;
    min-height: 30px;
}

/* Transcript page - mobile */
@media (max-width: 768px) {
    body.transcript-body {
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    body.transcript-body > .navbar {
        flex-shrink: 0;
    }

    body.transcript-body > main {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        margin-top: 0 !important;
        padding-top: 0.5rem;
    }

    .transcript-page {
        flex: 1;
        overflow: hidden;
        height: auto;
    }

    .transcript-toolbar {
        display: flex;
        gap: 0.5rem;
        padding: 0.5rem;
        background: #fff;
        flex-shrink: 0;
    }

    .transcript-toolbar .transcript-tab-btn {
        flex: 1;
    }

    .transcript-pane,
    .notes-pane {
        display: none;
    }

    .transcript-pane.mobile-active,
    .notes-pane.mobile-active {
        display: block;
        flex: 1;
        overflow-y: scroll;
    }

    .notes-pane.mobile-active {
        display: flex;
        flex-direction: column;
    }

    .notes-pane.mobile-active .notes-editor {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .notes-pane.mobile-active .notes-textarea {
        flex: 1;
        resize: none;
    }

    .transcript-pane {
        border-bottom: none;
    }

    .transcript-pane h5,
    .notes-pane h5 {
        display: none;
    }

    /* Hide native scrollbar on mobile (custom scroll indicator replaces it) */
    .transcript-pane.mobile-active,
    .notes-pane.mobile-active {
        scrollbar-width: none;
    }
    .transcript-pane.mobile-active::-webkit-scrollbar,
    .notes-pane.mobile-active::-webkit-scrollbar {
        display: none;
    }
    .notes-pane.mobile-active .notes-textarea {
        scrollbar-width: none;
    }
    .notes-pane.mobile-active .notes-textarea::-webkit-scrollbar {
        display: none;
    }
}

/* Topic Notes - book format */
.topic-notes-page {
    max-width: 750px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.topic-notes-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid #212529;
    padding-bottom: 1rem;
}

.topic-notes-toc {
    margin-bottom: 2rem;
}

.topic-notes-toc-heading {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.topic-notes-toc-list {
    padding-left: 1.5rem;
    line-height: 1.8;
}

.topic-notes-toc-list a {
    color: #0d6efd;
    text-decoration: none;
}

.topic-notes-toc-list a:hover {
    text-decoration: underline;
}

.topic-notes-divider {
    border-top: 1px solid #dee2e6;
    margin: 2rem 0;
}

.topic-notes-section {
    margin-bottom: 2.5rem;
}

.topic-notes-section-heading {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #dee2e6;
}

.topic-notes-page .markdown-content {
    font-size: 1.05rem;
    line-height: 1.75;
}

/* Flash Cards */
body.flashcards-body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

body.flashcards-body > .navbar {
    flex-shrink: 0;
}

body.flashcards-body > main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    margin-top: 0.5rem !important;
}

.flashcards-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.flashcard-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    padding: 3rem;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    min-height: 0;
    overflow: hidden;
}

.flashcard-display:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.flashcard-display.flashcard-complete {
    cursor: default;
}

.flashcard-text {
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    width: 100%;
    padding: 1rem;
}

.flashcard-footer {
    padding: 0.75rem 0;
    flex-shrink: 0;
}

.flashcard-counter {
    text-align: center;
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.flashcard-progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e5e7eb;
}

.flashcard-progress .progress-bar {
    background: linear-gradient(90deg, #2563eb, #7c3aed);
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Alert styling */
.alert {
    border-radius: 0.5rem;
}
