/* Notes Page Styles */

/* Variables */
:root {
    --notes-nav-width: 320px;
    --notes-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Container */
.notes-container {
    display: flex;
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
}

/* ================================
   Left Navigation Sidebar
================================ */
.notes-nav {
    width: var(--notes-nav-width);
    min-width: var(--notes-nav-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notes-nav-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.notes-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--notes-transition);
    font-size: 14px;
    font-weight: 500;
}

.notes-back-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.notes-nav-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.notes-nav-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* ================================
   Section Accordion
================================ */
.notes-section {
    margin-bottom: 8px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all var(--notes-transition);
}

.notes-section:hover {
    border-color: var(--accent-primary);
}

.notes-section-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: all var(--notes-transition);
}

.notes-section-header:hover {
    background: var(--bg-tertiary);
}

/* Progress Ring (Pie Chart) */
.notes-progress-ring {
    width: 28px;
    height: 28px;
    margin-right: 12px;
    position: relative;
    flex-shrink: 0;
}

.notes-progress-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.notes-progress-ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 3;
}

.notes-progress-ring-fill {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.notes-section-info {
    flex: 1;
    min-width: 0;
}

.notes-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-section-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.notes-section-chevron {
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
    transition: transform var(--notes-transition);
    flex-shrink: 0;
}

.notes-section.expanded .notes-section-chevron {
    transform: rotate(180deg);
}

/* Section Topics List */
.notes-topics-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--bg-secondary);
}

.notes-section.expanded .notes-topics-list {
    max-height: 500px;
}

.notes-topic-item {
    display: flex;
    align-items: center;
    padding: 10px 16px 10px 44px;
    cursor: pointer;
    transition: all var(--notes-transition);
    position: relative;
}

.notes-topic-item::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.notes-topic-item:last-child::before {
    bottom: 50%;
}

.notes-topic-item:hover {
    background: var(--bg-tertiary);
}

.notes-topic-item.active {
    background: rgba(88, 101, 242, 0.2);
}

/* Topic Checkbox */
.notes-topic-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--notes-transition);
    flex-shrink: 0;
    cursor: pointer;
    background: transparent;
}

.notes-topic-check:hover {
    border-color: var(--accent-primary);
    transform: scale(1.1);
}

.notes-topic-check.completed {
    background: var(--success);
    border-color: var(--success);
}

.notes-topic-check.completed svg {
    color: white;
    width: 12px;
    height: 12px;
}

.notes-topic-check svg {
    opacity: 0;
    transition: opacity var(--notes-transition);
}

.notes-topic-check.completed svg {
    opacity: 1;
}

.notes-topic-name {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-topic-item.active .notes-topic-name {
    color: var(--accent-primary);
    font-weight: 500;
}

/* ================================
   Content Panel (Right Side)
================================ */
.notes-content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.notes-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 32px 48px;
}

/* Notes Card */
.notes-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    animation: notesCardFadeIn 0.4s ease;
}

@keyframes notesCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notes-card-content {
    padding: 32px 40px;
    color: var(--text-primary);
    line-height: 1.7;
}

/* Markdown Content Styling */
.notes-card-content h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 24px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.notes-card-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 32px 0 16px 0;
}

.notes-card-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 24px 0 12px 0;
}

.notes-card-content p {
    margin: 0 0 16px 0;
    color: var(--text-secondary);
}

.notes-card-content ul,
.notes-card-content ol {
    margin: 0 0 16px 0;
    padding-left: 24px;
}

.notes-card-content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.notes-card-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.notes-card-content code {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    color: var(--accent-primary);
}

.notes-card-content pre {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.notes-card-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
    font-size: 14px;
}

.notes-card-content blockquote {
    border-left: 4px solid var(--accent-primary);
    margin: 16px 0;
    padding: 12px 20px;
    background: rgba(var(--accent-primary-rgb), 0.1);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

.notes-card-content blockquote strong {
    color: var(--accent-primary);
}

.notes-card-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

.notes-card-content th,
.notes-card-content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.notes-card-content th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.notes-card-content td {
    color: var(--text-secondary);
}

.notes-card-content tr:last-child td {
    border-bottom: none;
}

.notes-card-content hr {
    border: none;
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

/* ================================
   Subject Selection View
================================ */
.notes-selection-view {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px;
    animation: notesFadeIn 0.4s ease;
}

@keyframes notesFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.notes-selection-header {
    margin-bottom: 32px;
}

.notes-selection-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.notes-selection-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
}

.notes-subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.notes-subject-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 2px solid var(--border-color);
    padding: 24px;
    cursor: pointer;
    transition: all var(--notes-transition);
    position: relative;
    overflow: hidden;
}

.notes-subject-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.notes-subject-card.placeholder {
    opacity: 0.6;
    cursor: not-allowed;
}

.notes-subject-card.placeholder:hover {
    transform: none;
    border-color: var(--border-color);
    box-shadow: none;
}

.notes-subject-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    background: var(--accent-light);
}

.notes-subject-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
}

.notes-subject-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.notes-subject-code {
    font-size: 13px;
    color: var(--text-tertiary);
    margin: 0 0 16px 0;
}

.notes-subject-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.notes-subject-badge {
    display: inline-block;
    background: var(--accent-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 12px;
}

/* ================================
   Responsive
================================ */
@media (max-width: 900px) {
    .notes-nav {
        width: 280px;
        min-width: 280px;
    }

    .notes-content-scroll {
        padding: 24px;
    }

    .notes-card-content {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .notes-container {
        flex-direction: column;
    }

    .notes-nav {
        width: 100%;
        min-width: 100%;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .notes-content-scroll {
        padding: 16px;
    }
}

/* Empty State */
.notes-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 48px;
}

.notes-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.notes-empty-icon svg {
    width: 40px;
    height: 40px;
    color: var(--accent-primary);
}

.notes-empty-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.notes-empty-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}