/* Habits Page Styles */

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.page-title-section {
    flex: 1;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--color-text-secondary);
    font-size: 1rem;
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 1rem;
}

/* Habit Filters */
.habit-filters {
    margin-bottom: 2rem;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-tab:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.filter-tab.active {
    background: var(--color-primary);
    color: var(--color-text-on-primary);
    border-color: var(--color-primary);
}

.tab-icon {
    font-size: 1rem;
}

/* Today's Progress */
.today-progress {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

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

.progress-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

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

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

.stat-card {
    text-align: center;
    padding: 1rem;
    background: var(--color-surface-elevated);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Habits Grid */
.habits-section {
    margin-bottom: 2rem;
}

.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Habit Card */
.habit-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.habit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary);
}

.habit-card.completed {
    background: linear-gradient(135deg, var(--color-primary-700) 0%, var(--color-primary-900) 100%);
    color: var(--color-white) !important;
    border-color: var(--color-primary-700);
}

.habit-card.completed .habit-title,
.habit-card.completed .habit-description,
.habit-card.completed .habit-streak,
.habit-card.completed .habit-streak span {
    color: var(--color-white) !important;
}

.habit-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.habit-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
}

.habit-card.completed .habit-icon {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.habit-info {
    flex: 1;
}

.habit-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.habit-description {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin: 0;
}

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

.habit-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.habit-action-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.habit-card.completed .habit-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--color-white) !important;
}

.habit-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.habit-card.completed .habit-stats {
    border-color: rgba(255, 255, 255, 0.3);
}

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

.streak-icon {
    font-size: 1rem;
}

.habit-complete-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--color-primary);
    background: var(--color-primary);
    color: var(--color-text-on-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.habit-complete-btn:hover {
    background: var(--color-primary-dark);
}

.habit-complete-btn.completed {
    background: var(--color-success);
    border-color: var(--color-success);
    color: var(--color-white) !important;
}

.habit-complete-btn.completed:hover {
    background: var(--color-success-dark);
    color: var(--color-white) !important;
}

/* Lock Animation */
.habit-card.locked {
    animation: lockAnimation 0.6s ease-out;
}

@keyframes lockAnimation {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.lock-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    opacity: 0;
    animation: lockEffect 1s ease-out;
    pointer-events: none;
}

@keyframes lockEffect {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.empty-description {
    font-size: 1rem;
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Pomodoro Widget */
.pomodoro-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 320px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: all 0.3s ease;
}

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

.widget-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.widget-toggle {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.widget-toggle.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.widget-content {
    padding: 1rem;
    transition: all 0.3s ease;
}

.widget-content.collapsed {
    display: none;
}

.timer-display {
    text-align: center;
    margin-bottom: 1rem;
}

.timer-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
}

.timer-time {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.timer-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.timer-controls .btn {
    flex: 1;
    font-size: 0.875rem;
    padding: 0.5rem;
}

.timer-habit-selection {
    margin-top: 1rem;
}

.timer-habit-selection label {
    display: block;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

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

    .page-actions {
        justify-content: stretch;
    }

    .page-actions .btn {
        flex: 1;
    }

    .habits-grid {
        grid-template-columns: 1fr;
    }

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

    .pomodoro-widget {
        position: relative;
        bottom: auto;
        right: auto;
        width: 100%;
        margin-top: 2rem;
    }

    /* Filter tabs responsive improvements */
    .filter-tabs {
        gap: 0.375rem;
        justify-content: flex-start;
    }

    .filter-tab {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
        min-height: 44px; /* Touch target size */
        flex: 0 0 auto;
    }

    .tab-icon {
        font-size: 1rem;
    }
}

/* Tablet screens */
@media (max-width: 768px) and (min-width: 481px) {
    .filter-tabs {
        gap: 0.375rem;
        justify-content: center;
    }

    .filter-tab {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .filter-tabs {
        gap: 0.25rem;
    }

    .filter-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        border-radius: 0.375rem;
    }

    .tab-icon {
        font-size: 0.875rem;
    }

    /* Make habit filters more compact */
    .habit-filters {
        margin-bottom: 1.5rem;
    }
}
