:root {
    --bg-color: #1a1b26;
    --sidebar-color: #16161e;
    --card-bg: rgba(36, 40, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #a9b1d6;
    --text-secondary: #787c99;
    --accent-blue: #7aa2f7;
    --accent-purple: #bb9af7;
    --easy-color: #9ece6a;
    --medium-color: #e0af68;
    --hard-color: #f7768e;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    display: flex;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Sidebar */
aside {
    width: 320px;
    background-color: var(--sidebar-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: #fff;
    box-shadow: 0 0 15px rgba(122, 162, 247, 0.4);
}

.user-details h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.user-details p {
    font-size: 0.8rem;
    color: var(--accent-purple);
    margin: 0;
}

.tagline {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.4;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 20px;
}

.stat-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.stat-badge.easy { color: var(--easy-color); border-color: rgba(158, 206, 106, 0.3); }
.stat-badge.medium { color: var(--medium-color); border-color: rgba(224, 175, 104, 0.3); }
.stat-badge.hard { color: var(--hard-color); border-color: rgba(247, 118, 142, 0.3); }
.stat-badge.total { color: var(--accent-blue); border-color: rgba(122, 162, 247, 0.3); }

.sidebar-controls {
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.btn-journal {
    width: 100%;
    background: rgba(187, 154, 247, 0.1);
    border: 1px solid rgba(187, 154, 247, 0.3);
    color: var(--accent-purple);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 16px;
}

.btn-journal:hover {
    background: rgba(187, 154, 247, 0.2);
}

.btn-journal.active {
    background: var(--accent-purple);
    color: var(--bg-color);
}

.filters {
    display: flex;
    gap: 6px;
}

.filter-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 0;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.filter-btn.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}


.solution-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.category-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin: 20px 8px 8px;
}

.solution-item {
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.solution-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.solution-item.active {
    background: rgba(122, 162, 247, 0.1);
    border-left: 3px solid var(--accent-blue);
    padding-left: 13px; /* Compensate for border */
}

.solution-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 30px;
}

.solution-title {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-image: radial-gradient(circle at 50% 50%, rgba(122, 162, 247, 0.05) 0%, transparent 50%);
    overflow: hidden;
}

#journal-view {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    gap: 32px;
}

#journal-view.active {
    display: flex;
    flex-direction: column;
}

/* Timeline specific styles */
.timeline-container {
    position: relative;
    padding-left: 30px;
    margin-top: 10px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-blue), var(--accent-purple));
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -35px; /* aligned with timeline line */
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 3px solid var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue);
}

.timeline-header h3 {
    font-size: 1.25rem;
    color: #fff;
    margin-bottom: 12px;
    color: var(--accent-purple);
}

.timeline-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.timeline-content ul {
    margin-left: 20px;
    margin-top: 10px;
}

.timeline-content li {
    margin-bottom: 8px;
}


#content-view {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    gap: 32px;
}

#content-view.active {
    display: flex;
    flex-direction: column;
}

/* Header Section */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.title-group h2 {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-easy { background: rgba(158, 206, 106, 0.15); color: var(--easy-color); }
.badge-medium { background: rgba(224, 175, 104, 0.15); color: var(--medium-color); }
.badge-hard { background: rgba(247, 118, 142, 0.15); color: var(--hard-color); }

/* Panels */
.panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.panel-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Code Viewer */
.code-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

pre[class*="language-"] {
    background: transparent !important;
    margin: 0 !important;
    padding: 20px !important;
    font-size: 0.9rem !important;
}

/* Flow Table */
.flow-table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

th {
    text-align: left;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 12px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade {
    animation: fadeIn 0.4s ease forwards;
}
