/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #fafbfc;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

/* Dark theme variables */
[data-theme="dark"] {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --secondary-color: #34d399;
    --danger-color: #f87171;
    --warning-color: #fbbf24;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-alt: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #475569;
    --border-light: #334155;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth transitions for theme changes */
*,
*::before,
*::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

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

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subtitle {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

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

.search-box {
    position: relative;
    min-width: 300px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-danger:hover {
    background: #dc2626;
}

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

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

/* Theme toggle button */
.theme-toggle {
    background: var(--surface-alt);
    color: var(--text-primary);
    border: 1px solid var(--border);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.theme-toggle:hover {
    background: var(--border-light);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Features Banner */
.features-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
}

.features-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
}

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

.feature-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.feature-text h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: white;
}

.feature-text p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    line-height: 1.3;
}

.feature-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
    justify-self: center;
}

.feature-link {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    margin-left: 1rem;
}

.feature-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Responsive features banner */
@media (max-width: 768px) {
    .features-banner {
        padding: 0.75rem 1rem;
    }
    
    .features-content {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }
    
    .feature-divider {
        width: 40px;
        height: 1px;
        justify-self: center;
    }
    
    .feature-item {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .feature-link {
        margin-left: 0;
        margin-top: 0.5rem;
    }
}

/* Progress Overview */
.progress-overview {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 2rem;
}

.stats-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--surface-alt);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}

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

/* Filters */
.filters {
    background: var(--surface);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
}

.filters > div {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Mark Until functionality */
.filter-group .btn-primary {
    background: var(--primary-color);
    color: white;
    margin-left: 0.5rem;
}

.filter-group .btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

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

/* Filter buttons */
.filter-btn {
    transition: all 0.2s ease;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--surface, #ffffff);
    color: var(--text-primary, #374151);
}

.filter-btn.active,
.filter-btn[data-active="true"] {
    background: var(--primary-color, #6366f1) !important;
    color: white !important;
    border-color: var(--primary-color, #6366f1) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.filter-btn.active:hover,
.filter-btn[data-active="true"]:hover {
    background: var(--primary-dark, #4f46e5) !important;
    border-color: var(--primary-dark, #4f46e5) !important;
}

.filter-group .filter-btn + .filter-btn {
    margin-left: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.walkthrough-container {
    display: grid;
    gap: 1.5rem;
}

/* Day Cards */
.day-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

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

.day-header {
    background: var(--surface-alt);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.day-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.day-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.expand-icon {
    transition: transform 0.2s ease;
}

.day-card.expanded .expand-icon {
    transform: rotate(180deg);
}

.day-content {
    padding: 1.5rem;
    display: none;
}

.day-card.expanded .day-content {
    display: block;
}

.time-section {
    margin-bottom: 1.5rem;
}

.time-section:last-child {
    margin-bottom: 0;
}

.time-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.activity-list {
    display: grid;
    gap: 0.75rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface-alt);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.activity-item:hover {
    background: var(--border-light);
}

.activity-checkbox {
    margin-top: 0.25rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.activity-checkbox:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.activity-content {
    flex: 1;
}

.activity-text {
    color: var(--text-primary);
    line-height: 1.5;
}

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

.activity-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    border-radius: 12px;
}

.activity-tag.quest { background: var(--secondary-color); }
.activity-tag.beetle { background: var(--warning-color); }
.activity-tag.trophy { background: var(--primary-color); }
.activity-tag.dungeon { background: var(--danger-color); }
.activity-tag.debate { background: #8b5cf6; }
.activity-tag.follower { background: #f97316; }
.activity-tag.cooking { background: #06b6d4; }
.activity-tag.reading { background: #84cc16; }

.activity-item.completed {
    opacity: 0.7;
}

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

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.loading.hidden {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .search-box {
        min-width: 100%;
    }

    .filters > div {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 0;
    }

    .filter-group {
        width: 100%;
        flex-wrap: wrap;
    }

    .filter-group .btn-primary {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }

    .filter-group .filter-btn + .filter-btn {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .filter-group .filter-btn {
        flex: 1;
        min-width: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .day-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .activity-meta {
        flex-wrap: wrap;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--border-light);
}

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

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