/* Minimalist Theme System */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #e9ecef;
    --accent-primary: #0066cc;
    --accent-hover: #0052a3;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --radius: 4px;
}

[data-theme="dark"] {
    --bg-primary: #212529;
    --bg-secondary: #343a40;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --border-color: #495057;
    --accent-primary: #0d6efd;
    --accent-hover: #0b5ed7;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    transition: all 0.2s ease;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header - Minimalist */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.logo-img {
    height: 24px;
    margin-right: 0.5rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

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

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
}

/* User Dropdown - Minimalist */
.user-dropdown {
    position: relative;
}

.user-menu-toggle {
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.user-menu-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 150px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.user-dropdown:hover .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.user-dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Main Content */
.main {
    flex: 1;
    padding: 2rem;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Demo Banner */
.demo-banner {
    background: linear-gradient(135deg, var(--accent-primary), var(--success-color));
    color: white;
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 2rem;
    animation: slideDown 0.5s ease;
}

.demo-banner p {
    margin: 0;
    font-size: 1rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Section - Minimalist */
.hero {
    text-align: center;
    padding: 4rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.hero-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 1rem 0;
}

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

.hero-btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Secondary Sections */
.hero-secondary, .hero-third {
    padding: 2rem 0;
    text-align: center;
}

.hero-secondary h2, .hero-third h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero-secondary p, .hero-third p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.hero-secondary ul {
    list-style: none;
    margin: 1rem 0;
}

.hero-secondary li {
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.hero-third-divider {
    width: 60px;
    height: 2px;
    background: var(--accent-primary);
    border: none;
    margin: 1rem auto;
}

/* Habits Page */
.habits-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.habits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.habits-header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.habits-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.stat-badge {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
}

.stat-badge.success {
    background: var(--success-color);
    color: white;
}

.stat-badge.warning {
    background: var(--warning-color);
    color: white;
}

.add-habit-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-habit-btn:hover {
    background: var(--accent-hover);
}

/* Habit Cards */
.habits-list {
    display: grid;
    gap: 1rem;
}

.habit-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.habit-card:hover {
    box-shadow: var(--shadow);
}

.habit-header {
    margin-bottom: 1rem;
}

.habit-info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.habit-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.habit-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.habit-category, .habit-priority, .habit-difficulty {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.7rem;
}

.habit-streak, .habit-goal {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.habit-progress {
    margin: 1rem 0;
}

.progress-bar {
    background: var(--bg-secondary);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    background: var(--accent-primary);
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.habit-tags {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.7rem;
}

.habit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.track-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.track-btn:hover, .edit-btn:hover, .delete-btn:hover {
    transform: translateY(-1px);
}

/* Modal - Minimalist */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-primary);
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

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

.modal h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.form-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-actions button[type="submit"] {
    background: var(--accent-primary);
    color: white;
}

.form-actions button[type="submit"]:hover {
    background: var(--accent-hover);
}

.form-actions button[type="button"] {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.form-actions button[type="button"]:hover {
    background: var(--border-color);
}

/* Footer - Minimalist */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0 1rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-section p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: var(--accent-primary);
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.footer-social a {
    display: inline-block;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.footer-social a:hover {
    background: var(--bg-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Analytics Page */
.analytics-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.analytics-container h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

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

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.chart-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.chart-container h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.chart {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Calendar Page */
.calendar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.calendar-container h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.calendar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.calendar-nav-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

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

.calendar-controls h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.legend-color.perfect {
    background: var(--success-color);
}

.legend-color.good {
    background: var(--accent-primary);
}

.legend-color.partial {
    background: var(--warning-color);
}

.legend-color.missed {
    background: var(--border-color);
}

.legend-item span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.calendar-grid-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.weekday {
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.calendar-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.calendar-grid {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.calendar-nav button {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.calendar-nav button:hover {
    background: var(--border-color);
}

.calendar-month {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.calendar-day {
    background: var(--bg-primary);
    padding: 1rem;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.calendar-day.other-month {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.calendar-day.today {
    background: var(--accent-primary);
    color: white;
}

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

.calendar-events {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.calendar-event {
    background: var(--success-color);
    color: white;
    padding: 0.125rem 0.25rem;
    border-radius: 2px;
    font-size: 0.7rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 0 1rem;
    }
    
    .nav {
        gap: 0.5rem;
    }
    
    .nav a {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .habits-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .habits-stats {
        flex-wrap: wrap;
    }
    
    .habit-actions {
        flex-wrap: wrap;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .calendar-days {
        gap: 0;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 0.5rem;
    }
}

/* Help and Legal Pages */
.help-section, .legal-section {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.help-section:last-child, .legal-section:last-child {
    border-bottom: none;
}

.help-section h2, .legal-section h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.help-section p, .legal-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.help-section ul, .legal-section ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.help-section li, .legal-section li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.help-section a, .legal-section a {
    color: var(--accent-primary);
    text-decoration: none;
}

.help-section a:hover, .legal-section a:hover {
    text-decoration: underline;
}

/* Auth Forms */
.auth-container {
    max-width: 400px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form button {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-form button:hover {
    background: var(--accent-hover);
}

.auth-form button:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

.auth-links {
    text-align: center;
    margin-top: 1rem;
}

.auth-links a {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Utility Classes */
.no-habits {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-style: italic;
}

.hidden {
    display: none;
}

/* Notification System */
.notifications {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
}

.notification {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow);
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--danger-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
