/* ============================================
   SELFOS - Productivity Operating System
   CSS Variables & Base Styles
   ============================================ */

:root {
    /* Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f0f2f5;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border-color: #e0e0e0;
    --accent-primary: #2563eb;
    --accent-secondary: #10b981;
    --accent-warn: #f59e0b;
    --accent-danger: #ef4444;
    
    --priority-high: #dc2626;
    --priority-medium: #f59e0b;
    --priority-low: #10b981;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #f5f5f5;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --border-color: #3a3a3a;
    --accent-primary: #3b82f6;
    --accent-secondary: #14b983;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    overflow-x: hidden;
}

.particle-bg {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: -1;
    background: 
        radial-gradient(circle at 20% 50%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
}

.container {
    display: flex;
    height: 100vh;
    background-color: var(--bg-primary);
}

.sidebar {
    width: 240px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    overflow-y: auto;
    position: relative;
}

.main-content {
    margin-left: 0;
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    background-color: var(--bg-primary);
}

.sidebar-header {
    text-align: center;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.app-logo {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.sidebar-header .subtitle {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.main-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

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

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

.nav-btn.active {
    background-color: var(--accent-primary);
    color: white;
}

.nav-btn .icon {
    display: inline-block;
    font-size: 18px;
}

.sidebar-footer {
    display: flex;
    gap: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.theme-toggle,
.reset-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.theme-toggle:hover,
.reset-btn:hover {
    background-color: var(--bg-tertiary);
}

.section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.section.active {
    display: block;
}

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

.section-header {
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.add-task-form,
.add-goal-form,
.add-course-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 20px;
    padding: 14px;
    background-color: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.date-display {
    font-size: 14px;
    color: var(--text-tertiary);
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: var(--transition);
    cursor: default;
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 4px;
}

.stat-sublabel {
    font-size: 12px;
    color: var(--text-secondary);
}

.add-task-form,
.add-goal-form,
.add-course-form {
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    gap: 12px;
    margin-bottom: 32px;
    padding: 20px;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.form-input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input.small {
    max-width: 120px;
}

.form-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    transition: var(--transition);
}

.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.task-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background-color: var(--bg-secondary);
    border-radius: 10px;
    border-left: 4px solid var(--border-color);
    transition: var(--transition);
}

.task-item.high {
    border-left-color: var(--priority-high);
}

.task-item.medium {
    border-left-color: var(--priority-medium);
}

.task-item.low {
    border-left-color: var(--priority-low);
}

.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-name {
    text-decoration: line-through;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.task-name {
    font-weight: 500;
    color: var(--text-primary);
}

.task-time {
    background-color: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.task-rate {
    display: flex;
    gap: 4px;
}

.rate-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.rate-btn:hover {
    transform: scale(1.2);
}

.task-delete {
    width: 28px;
    height: 28px;
    border: none;
    background-color: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    cursor: pointer;
    color: var(--accent-danger);
    transition: var(--transition);
}

.task-delete:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

.goals-list,
.courses-list,
.completed-courses-list,
.achieved-goals-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.goal-card,
.course-card,
.completed-course-card,
.achieved-goal-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: var(--transition);
}

.goal-card:hover,
.course-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.completed-course-card,
.achieved-goal-card {
    opacity: 0.8;
    border-color: var(--accent-secondary);
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.goal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.goal-meta {
    display: flex;
    gap: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-category {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--accent-primary);
}

.badge-priority {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--accent-warn);
}

.badge-priority.high {
    background-color: rgba(220, 38, 38, 0.1);
    color: var(--priority-high);
}

.badge-priority.low {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--priority-low);
}

.progress-section {
    margin-bottom: 12px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.deadline-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.daily-notes {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-top: 32px;
}

.daily-notes h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.mood-selector {
    margin-bottom: 24px;
}

.mood-selector label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.mood-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.mood-btn {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-color);
    background-color: var(--bg-primary);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.mood-btn:hover {
    transform: scale(1.1);
}

.mood-btn.active {
    border-color: var(--accent-primary);
    background-color: rgba(37, 99, 235, 0.1);
}

.comparison-section {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.comparison-section h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.comparison-cards {
    display: flex;
    align-items: center;
    gap: 16px;
}

.comparison-card {
    flex: 1;
    padding: 16px;
    background-color: var(--bg-primary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.comparison-card.highlight {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(16, 185, 129, 0.05));
}

.comparison-separator {
    font-weight: 600;
    color: var(--text-tertiary);
    font-size: 12px;
}

.comparison-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.comparison-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 4px;
}

.comparison-tasks {
    font-size: 12px;
    color: var(--text-secondary);
}

.quote-section {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(16, 185, 129, 0.1));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.quote-content {
    margin-bottom: 16px;
}

.quote-content p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.6;
}

#quoteAuthor {
    margin-top: 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    font-style: normal !important;
}

.quote-refresh {
    padding: 8px 16px;
    background-color: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.quote-refresh:hover {
    transform: translateY(-2px);
}

.weekly-progress {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.weekly-progress h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 16px;
}

.weekday {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.day-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.day-bar {
    width: 40px;
    height: 120px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.day-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    transition: height 0.3s ease;
    border-radius: 4px;
}

.day-hours {
    font-size: 11px;
    color: var(--text-tertiary);
}

.badges-section {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.badges-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
}

.achievement-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    text-align: center;
    transition: var(--transition);
    cursor: default;
}

.achievement-badge.unlocked {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(16, 185, 129, 0.1));
}

.badge-icon {
    font-size: 32px;
}

.badge-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.achievement-badge.unlocked .badge-name {
    color: var(--accent-primary);
}

.analytics-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.analytics-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.chart-container {
    display: flex;
    gap: 24px;
    align-items: center;
}

.pie-chart {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--accent-primary) 0deg 120deg, var(--accent-secondary) 120deg 240deg, var(--accent-warn) 240deg);
    box-shadow: var(--shadow-md);
}

.chart-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.progress-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-number {
    font-weight: 600;
    color: var(--accent-primary);
}

.priority-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.priority-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.priority-label {
    width: 120px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.priority-bar-bg {
    flex: 1;
    height: 24px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
}

.priority-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.priority-bar-fill.high {
    background-color: var(--priority-high);
}

.priority-bar-fill.medium {
    background-color: var(--priority-medium);
}

.priority-bar-fill.low {
    background-color: var(--priority-low);
}

.priority-count {
    width: 40px;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

.planning-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.planning-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.tomorrow-list {
    background-color: var(--bg-primary);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.tomorrow-item {
    padding: 8px 12px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
}

.tomorrow-item:last-child {
    margin-bottom: 0;
}

.empty-state {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    padding: 20px;
}

.week-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.overview-day {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.overview-day-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.overview-day-tasks {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
}

.saved-reflections,
.previous-reflections {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-top: 32px;
    margin-bottom: 24px;
}

.saved-reflections h3,
.previous-reflections h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.reflection-card,
.goal-day-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    overflow: hidden;
}

.reflection-card:last-child,
.goal-day-card:last-child {
    margin-bottom: 0;
}

.reflection-date,
.goal-date {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.reflection-date-text,
.goal-date-text {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.reflection-mood,
.goal-date-label {
    font-size: 20px;
    display: flex;
    gap: 4px;
}

.reflection-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}

.reflection-item {
    display: flex;
    flex-direction: column;
}

.reflection-item-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.reflection-item-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    padding: 10px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    max-height: 150px;
    overflow-y: auto;
}

.goal-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
    padding: 12px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 3px solid var(--accent-primary);
}

.no-reflection-message,
.no-goals-message {
    text-align: center;
    color: var(--text-tertiary);
    padding: 30px 20px;
    font-size: 14px;
}

.reflection-status {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.completed-section {
    background-color: var(--bg-secondary);
    border: 2px solid var(--accent-secondary);
    border-radius: 12px;
    padding: 24px;
    margin-top: 40px;
    margin-bottom: 32px;
}

.completed-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--accent-secondary);
}

.completed-course-card,
.achieved-goal-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--accent-secondary);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    opacity: 0.85;
}

.completed-course-card:last-child,
.achieved-goal-card:last-child {
    margin-bottom: 0;
}

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    width: 36px;
    height: 36px;
    flex-direction: column;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 4px;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 2.5px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
        padding: 16px 12px;
    }

    .sidebar-header {
        margin-bottom: 32px;
    }

    .sidebar-header h1 {
        font-size: 18px;
    }

    .main-content {
        padding: 24px;
    }

    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .add-task-form,
    .add-goal-form,
    .add-course-form {
        grid-template-columns: 1fr auto auto;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 240px;
        height: 100vh;
        z-index: 1099;
        transition: left 0.3s ease;
        border-right: 1px solid var(--border-color);
        border-bottom: none;
        overflow-y: auto;
    }

    .sidebar.active {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }

    .main-content {
        margin-left: 0;
        padding: 56px 12px 16px 12px;
        width: 100%;
        overflow-y: auto;
        position: relative;
    }

    .main-content::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 48px;
        background-color: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        z-index: 1050;
        pointer-events: none;
    }

    .section-header h2 {
        font-size: 24px;
    }

    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 24px;
    }

    .add-task-form,
    .add-goal-form,
    .add-course-form {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .form-input.small {
        max-width: none;
    }

    .task-item {
        grid-template-columns: auto 1fr auto auto auto;
        gap: 12px;
    }

    .task-rate {
        display: flex;
    }

    .task-time {
        display: block;
    }

    .comparison-cards {
        flex-direction: column;
    }

    .chart-container {
        flex-direction: column;
    }

    .weekdays {
        grid-template-columns: repeat(7, 1fr);
    }

    .day-bar {
        height: 80px;
    }

    .reflection-content {
        grid-template-columns: 1fr;
    }

    .reflection-date {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 56px 10px 12px 10px;
    }

    .mobile-menu-toggle {
        top: 10px;
        left: 10px;
        width: 32px;
        height: 32px;
        padding: 4px;
    }

    .section-header h2 {
        font-size: 20px;
    }

    .section-header {
        margin-bottom: 20px;
    }

    .quick-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 10px;
    }

    .comparison-section {
        padding: 16px;
    }

    .comparison-cards {
        flex-direction: column;
        gap: 12px;
    }

    .comparison-card {
        padding: 12px;
    }

    .comparison-value {
        font-size: 22px;
    }

    .quote-section {
        padding: 14px;
        margin-bottom: 16px;
    }

    .quote-content p {
        font-size: 13px;
    }

    .weekly-progress {
        padding: 14px;
        margin-bottom: 16px;
    }

    .weekdays {
        gap: 12px;
    }

    .day-bar {
        width: 36px;
        height: 70px;
    }

    .badges-section {
        padding: 14px;
        margin-bottom: 16px;
    }

    .badges-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .badge-icon {
        font-size: 24px;
    }

    .task-list {
        gap: 8px;
        margin-bottom: 24px;
    }

    .task-item {
        padding: 12px;
        grid-template-columns: auto 1fr auto auto auto;
        gap: 8px;
    }

    .task-checkbox {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .task-name {
        font-size: 13px;
    }

    .task-rate {
        display: flex;
        gap: 2px;
    }

    .rate-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }

    .task-delete {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
    }

    .add-task-form,
    .add-goal-form,
    .add-course-form {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
        margin-bottom: 16px;
    }

    .form-input {
        padding: 8px 12px;
        font-size: 13px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 8px 16px;
        font-size: 12px;
    }

    .goals-list,
    .courses-list,
    .completed-courses-list,
    .achieved-goals-list {
        gap: 10px;
        margin-bottom: 16px;
    }

    .goal-card,
    .course-card {
        padding: 14px;
        margin-bottom: 0;
    }

    .goal-header {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }

    .goal-title {
        font-size: 14px;
    }

    .goal-meta {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }

    .progress-bar {
        height: 6px;
    }

    .goal-card > div:last-child {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .goal-card button {
        width: 100%;
    }

    .goal-card input[type="number"] {
        width: 100%;
    }

    .form-textarea {
        min-height: 80px;
        padding: 8px 12px;
        font-size: 13px;
    }

    .daily-notes {
        padding: 14px;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .daily-notes h3 {
        margin-bottom: 14px;
        font-size: 14px;
    }

    .mood-options {
        gap: 8px;
    }

    .mood-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .planning-card {
        padding: 14px;
        margin-bottom: 14px;
    }

    .completed-section {
        padding: 14px;
        margin-top: 16px;
        margin-bottom: 14px;
    }

    .reflection-card,
    .goal-day-card {
        padding: 12px;
        margin-bottom: 8px;
    }

    .reflection-item-text,
    .goal-text {
        font-size: 12px;
        padding: 8px;
    }

    .analytics-card {
        padding: 14px;
        margin-bottom: 14px;
    }

    .pie-chart {
        width: 120px;
        height: 120px;
    }

    .chart-legend {
        gap: 8px;
    }

    .legend-item {
        font-size: 12px;
    }

    .priority-label {
        width: 100px;
        font-size: 12px;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

@media print {
    .sidebar,
    .sidebar-footer,
    .btn-primary,
    .btn-secondary,
    .mobile-menu-toggle {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }
}

/* ============================================
   Library Section
   ============================================ */

.add-book-form {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    margin-bottom: 24px;
    padding: 20px;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.page-input-group {
    display: flex;
    gap: 8px;
}

.page-input-group input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.page-input-group button {
    padding: 8px 16px;
}

.completed-books-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.completed-book-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--accent-secondary);
    border-radius: 10px;
    padding: 14px;
    opacity: 0.85;
}

/* ============================================
   NoFap Section
   ============================================ */

.nofap-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
}

.nofap-controls button {
    padding: 10px 16px;
}

.nofap-calendar {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background-color: var(--bg-primary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 14px;
}

.calendar-day:hover {
    transform: scale(1.1);
}

.calendar-day.win {
    background-color: #10b981;
    border-color: #059669;
    color: white;
}

.calendar-day.loss {
    background-color: #ef4444;
    border-color: #dc2626;
    color: white;
}

.calendar-day.empty {
    color: var(--text-tertiary);
    cursor: not-allowed;
}

.day-selection-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    display: none;
}

.day-selection-modal.active {
    display: block;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
}

.modal-overlay.active {
    display: block;
}

.day-selection-modal h4 {
    margin-bottom: 16px;
    font-size: 16px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-buttons button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-win {
    background-color: #10b981;
    color: white;
}

.btn-win:hover {
    background-color: #059669;
}

.btn-loss {
    background-color: #ef4444;
    color: white;
}

.btn-loss:hover {
    background-color: #dc2626;
}

.nofap-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.month-history {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.month-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.month-card h4 {
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}

.mini-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.mini-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.mini-day.win {
    background-color: #10b981;
    border-color: #059669;
    color: white;
}

.mini-day.loss {
    background-color: #ef4444;
    border-color: #dc2626;
    color: white;
}

/* ============================================
   About Section
   ============================================ */

.about-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.about-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.about-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 16px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.about-card p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.feature-list {
    list-style: none;
    margin-left: 0;
}

.feature-list li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.feature-list li strong {
    color: var(--text-primary);
}

.creator-card {
    border: 2px solid var(--accent-primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(16, 185, 129, 0.05));
}

.creator-profile {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.creator-avatar {
    font-size: 64px;
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
}

.creator-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.creator-info {
    flex: 1;
}

.creator-info h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.creator-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.creator-bio {
    font-style: italic;
    margin-bottom: 16px !important;
}

.creator-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px !important;
}

.social-icons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    background-color: var(--bg-tertiary);
    border-radius: 50%;
    color: var(--accent-primary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 20px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    padding: 0 8px;
}

.social-icons a:hover {
    background-color: var(--accent-primary);
    color: white;
    transform: scale(1.1);
}

.creator-bio {
    font-style: italic;
    margin-bottom: 16px !important;
}

.creator-links,
.creator-projects {
    margin-top: 16px;
}

.creator-links p,
.creator-projects p {
    margin-bottom: 8px;
    font-weight: 600;
}

.creator-links ul,
.creator-projects ul {
    list-style: none;
    margin-left: 0;
}

.creator-links li,
.creator-projects li {
    margin-bottom: 6px;
}

.creator-links a,
.creator-projects a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
}

.creator-links a:hover,
.creator-projects a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .add-book-form {
        grid-template-columns: 1fr;
    }

    .nofap-controls {
        flex-direction: column;
    }

    .nofap-controls button {
        width: 100%;
    }

    .nofap-stats {
        grid-template-columns: 1fr;
    }

    .creator-profile {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .creator-avatar {
        font-size: 48px;
    }

    .page-input-group {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .page-input-group input,
    .page-input-group button {
        width: 100%;
    }
}
