@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-app: #0b0e14;
    --bg-card: #151b23;
    --bg-card-hover: #1f2631;
    --border-color: #212830;
    --border-hover: #30363d;
    --text-primary: #f0f6fc;
    --text-muted: #8d96a0;
    
    --color-accent: #2f81f7;
    --color-accent-hover: #58a6ff;
    --color-accent-bg: rgba(47, 129, 247, 0.15);
    
    --color-success: #3fb950;
    --color-success-bg: rgba(63, 185, 80, 0.1);
    --color-success-border: rgba(63, 185, 80, 0.25);
    
    --color-warning: #d29922;
    --color-warning-bg: rgba(210, 153, 34, 0.1);
    --color-warning-border: rgba(210, 153, 34, 0.25);
    
    --color-danger: #f85149;
    --color-danger-bg: rgba(248, 81, 73, 0.1);
    --color-danger-border: rgba(248, 81, 73, 0.25);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
}

[data-theme="light"] {
    --bg-app: #f6f8fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f3f4f6;
    --border-color: #d0d7de;
    --border-hover: #afb8c1;
    --text-primary: #24292f;
    --text-muted: #57606a;
    
    --color-accent: #0969da;
    --color-accent-hover: #0550ae;
    --color-accent-bg: rgba(9, 105, 218, 0.1);
    
    --color-success: #1a7f37;
    --color-success-bg: rgba(26, 127, 55, 0.08);
    --color-success-border: rgba(26, 127, 55, 0.2);
    
    --color-warning: #9a6700;
    --color-warning-bg: rgba(154, 103, 0, 0.08);
    --color-warning-border: rgba(154, 103, 0, 0.2);
    
    --color-danger: #cf222e;
    --color-danger-bg: rgba(207, 34, 46, 0.08);
    --color-danger-border: rgba(207, 34, 46, 0.2);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Container Layout */
.app-container {
    display: flex;
    flex: 1;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px 24px 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.brand-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--color-accent), #a371f7);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
}

.brand-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item a:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-item.active a {
    background-color: var(--color-accent-bg);
    color: var(--color-accent-hover);
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 12px 0 12px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 24px;
    height: 24px;
    background-color: var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 11px;
}

.logout-btn {
    align-self: flex-start;
    color: var(--color-danger);
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    text-decoration: underline;
}

/* Main Content Area */
.main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    display: none; /* Only visible on mobile */
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    justify-content: space-between;
    align-items: center;
}

.main-content {
    flex: 1;
    padding: 40px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    overflow-y: auto;
}

/* Page Header */
.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.page-description {
    font-size: 14px;
    color: var(--text-muted);
}

/* Cards & Grid Containers */
.grid {
    display: grid;
    gap: 24px;
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

/* Stat Cards */
.stat-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

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

/* Daily Quote Component */
.quote-card {
    background: linear-gradient(135deg, rgba(47, 129, 247, 0.05), rgba(163, 113, 247, 0.05));
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.quote-text {
    font-size: 18px;
    font-style: italic;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.quote-author {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Checklist Items */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background-color: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.task-item:hover {
    border-color: var(--border-hover);
}

.task-checkbox-container {
    display: flex;
    align-items: center;
    height: 24px;
}

.task-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    background-color: transparent;
}

.task-checkbox:checked {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.task-checkbox:checked::after {
    content: "✓";
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.task-details {
    flex: 1;
}

.task-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.task-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.task-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-note-input {
    width: 100%;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.task-note-input:focus {
    border-color: var(--color-accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    text-decoration: none;
}

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

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

.btn-primary:disabled {
    background-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

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

.btn-danger {
    background-color: var(--color-danger-bg);
    border-color: var(--color-danger-border);
    color: var(--color-danger);
}

.btn-danger:hover {
    background-color: var(--color-danger);
    color: #ffffff;
}

/* Calendar Styling */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    gap: 8px;
}

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

.calendar-day {
    aspect-ratio: 1;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    min-height: 70px;
}

.calendar-day:hover {
    border-color: var(--border-hover);
    background-color: var(--bg-card-hover);
}

.calendar-day.empty {
    visibility: hidden;
    cursor: default;
}

.day-number {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.day-indicator {
    height: 6px;
    width: 6px;
    border-radius: 50%;
    align-self: center;
    margin-bottom: 4px;
}

/* Day states */
.calendar-day.state-completed {
    background-color: var(--color-success-bg);
    border-color: var(--color-success-border);
}
.calendar-day.state-completed .day-number {
    color: var(--color-success);
    font-weight: 600;
}
.calendar-day.state-completed .day-indicator {
    background-color: var(--color-success);
}

.calendar-day.state-partial {
    background-color: var(--color-warning-bg);
    border-color: var(--color-warning-border);
}
.calendar-day.state-partial .day-number {
    color: var(--color-warning);
    font-weight: 600;
}
.calendar-day.state-partial .day-indicator {
    background-color: var(--color-warning);
}

.calendar-day.state-missed {
    background-color: var(--color-danger-bg);
    border-color: var(--color-danger-border);
}
.calendar-day.state-missed .day-number {
    color: var(--color-danger);
    font-weight: 600;
}
.calendar-day.state-missed .day-indicator {
    background-color: var(--color-danger);
}

.calendar-day.state-today {
    border-color: var(--color-accent);
    box-shadow: inset 0 0 0 1px var(--color-accent);
}

.calendar-day.state-today .day-number {
    color: var(--color-accent-hover);
    font-weight: 700;
}

.calendar-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* Timeline Components */
.timeline-list {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-left: 10px;
}

.timeline-node {
    position: relative;
}

.timeline-node::before {
    content: "";
    position: absolute;
    left: -27px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--color-success);
    border: 2px solid var(--bg-app);
}

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

.timeline-day {
    font-size: 16px;
    font-weight: 600;
}

.timeline-date {
    font-size: 12px;
    color: var(--text-muted);
}

.timeline-tasks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.timeline-task-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    color: var(--color-success);
    font-weight: 500;
}

.timeline-note {
    font-size: 13px;
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    backdrop-filter: blur(4px);
}

.modal-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    animation: modal-enter 0.2s ease-out;
}

@keyframes modal-enter {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 24px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Login Page Layout */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .brand-icon {
    margin: 0 auto 16px auto;
    width: 48px;
    height: 48px;
    font-size: 24px;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field {
    width: 100%;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.input-field:focus {
    border-color: var(--color-accent);
}

.login-error {
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    color: var(--color-danger);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    text-align: center;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 32px;
}

.settings-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.import-export-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Goal Page Styling */
.goal-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    text-align: center;
}

.goal-180 {
    font-size: 80px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-accent), #a371f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.goal-subtitle {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.goal-statement {
    font-size: 20px;
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 600px;
}

/* Rules List styling */
.rules-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.rules-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
}

.rules-num {
    width: 28px;
    height: 28px;
    background-color: var(--color-accent-bg);
    color: var(--color-accent-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

/* Utility classes */
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.text-center { text-align: center; }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    font-size: 24px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
        display: none; /* Controlled by toggle on mobile */
    }
    
    .sidebar.active {
        display: flex;
    }
    
    .top-bar {
        display: flex;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    .calendar-header {
        font-size: 10px;
    }
    
    .calendar-day {
        min-height: 50px;
        padding: 4px;
    }
    
    .day-number {
        font-size: 10px;
    }
}
