/* ===============================
   DASHBOARD STYLES - Habit Tracker
   =============================== */

/* Dashboard Layout */
.dashboard {
    width: 100%;
    min-height: 100vh;
    background: var(--darker-bg);
    position: relative;
    overflow-x: hidden;
}

.dashboard::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 10% 10%, rgba(255, 0, 0, 0.05) 0%, transparent 30%),
        radial-gradient(circle at 90% 90%, rgba(139, 0, 0, 0.05) 0%, transparent 30%),
        radial-gradient(circle at 50% 50%, rgba(102, 0, 0, 0.03) 0%, transparent 50%);
    z-index: 0;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 0, 0, 0.1);
}

.dashboard-header .logo {
    margin: 0;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--neon-red), var(--crimson));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
}

.user-name {
    color: var(--text-light);
    font-weight: 600;
    font-size: 16px;
}

.logout-btn {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: var(--neon-red);
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(17, 17, 17, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 0, 0, 0.15);
    border-radius: 16px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: rgba(255, 0, 0, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 0, 0, 0.1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--neon-red), var(--crimson));
}

.stat-card.current-streak::before {
    background: linear-gradient(90deg, #ff0000, #ff6b6b);
}

.stat-card.longest-streak::before {
    background: linear-gradient(90deg, #c21807, #ff4444);
}

.stat-card.progress::before {
    background: linear-gradient(90deg, #8b0000, #dc143c);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 15px;
    background: linear-gradient(45deg, var(--neon-red), var(--crimson));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat-value {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 5px;
    color: var(--text-light);
    font-family: 'Space Grotesk', sans-serif;
}

.stat-label {
    color: var(--text-dim);
    font-size: 15px;
    margin-bottom: 15px;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: var(--success-red);
    font-weight: 600;
}

.stat-change.negative {
    color: #ff3333;
}

.stat-change i {
    font-size: 12px;
}

/* Calendar Section */
.calendar-section {
    background: rgba(17, 17, 17, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 0, 0, 0.15);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 40px;
}

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

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-light);
    font-family: 'Space Grotesk', sans-serif;
}

.section-subtitle {
    color: var(--text-dim);
    font-size: 14px;
    margin-top: 5px;
}

.year-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 0, 0, 0.1);
}

.year-selector button {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.year-selector button:hover {
    color: var(--neon-red);
    background: rgba(255, 0, 0, 0.1);
}

.year-selector span {
    color: var(--text-light);
    font-weight: 600;
    font-size: 16px;
    min-width: 80px;
    text-align: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.month-container {
    margin-bottom: 25px;
}

.month-header {
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 0, 0, 0.1);
}

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

.day-header {
    color: var(--text-dim);
    font-size: 11px;
    text-align: center;
    padding: 5px 0;
    font-weight: 600;
    text-transform: uppercase;
}

.day-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.day-cell.empty {
    background: transparent;
    cursor: default;
}

.day-cell.past {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-dim);
}

.day-cell.today {
    background: rgba(255, 0, 0, 0.1);
    border: 2px solid var(--neon-red);
    color: var(--neon-red);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.2);
}

.day-cell.completed {
    background: linear-gradient(45deg, rgba(255, 0, 0, 0.2), rgba(220, 20, 60, 0.2));
    color: var(--success-red);
    border: 1px solid rgba(255, 0, 0, 0.3);
}

.day-cell.missed {
    background: rgba(255, 51, 51, 0.1);
    color: #ff3333;
    border: 1px solid rgba(255, 51, 51, 0.2);
}

.day-cell.future {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.day-cell:hover:not(.empty) {
    transform: scale(1.1);
    z-index: 2;
}

.day-cell.completed:hover {
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
}

/* Progress Overview */
.progress-overview {
    background: rgba(17, 17, 17, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 0, 0, 0.15);
    border-radius: 16px;
    padding: 30px;
}

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

.progress-stat {
    text-align: center;
}

.progress-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 5px;
    font-family: 'Space Grotesk', sans-serif;
}

.progress-label {
    color: var(--text-dim);
    font-size: 14px;
}

.progress-bar-container {
    margin-top: 20px;
}

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

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

.progress-percentage {
    color: var(--neon-red);
    font-weight: 700;
    font-size: 18px;
}

.progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-red), var(--crimson));
    border-radius: 6px;
    position: relative;
    transition: width 1s ease-in-out;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Habits List */
.habits-section {
    margin-top: 40px;
}

.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.habit-card {
    background: rgba(17, 17, 17, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 0, 0, 0.15);
    border-radius: 16px;
    padding: 25px;
    transition: all 0.3s ease;
}

.habit-card:hover {
    border-color: rgba(255, 0, 0, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 0, 0, 0.1);
}

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

.habit-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-light);
}

.habit-category {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 0, 0, 0.1);
    color: var(--neon-red);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 5px;
}

.habit-streak {
    text-align: right;
}

.streak-count {
    font-size: 28px;
    font-weight: 800;
    color: var(--neon-red);
    font-family: 'Space Grotesk', sans-serif;
}

.streak-label {
    color: var(--text-dim);
    font-size: 13px;
}

.habit-progress {
    margin-bottom: 20px;
}

.habit-progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.habit-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-red), var(--crimson));
    border-radius: 3px;
}

.habit-stats {
    display: flex;
    justify-content: space-between;
    color: var(--text-dim);
    font-size: 13px;
}

.habit-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn.complete {
    background: rgba(255, 0, 0, 0.1);
    color: var(--neon-red);
    border: 1px solid rgba(255, 0, 0, 0.3);
}

.action-btn.complete:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: translateY(-2px);
}

.action-btn.edit {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn.edit:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-dim);
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 4px;
}

.legend-color.completed {
    background: linear-gradient(45deg, rgba(255, 0, 0, 0.2), rgba(220, 20, 60, 0.2));
    border: 1px solid rgba(255, 0, 0, 0.3);
}

.legend-color.missed {
    background: rgba(255, 51, 51, 0.1);
    border: 1px solid rgba(255, 51, 51, 0.2);
}

.legend-color.today {
    background: rgba(255, 0, 0, 0.1);
    border: 2px solid var(--neon-red);
}

.legend-color.future {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 20px;
    color: rgba(255, 0, 0, 0.2);
}

.empty-state h3 {
    color: var(--text-light);
    margin-bottom: 10px;
    font-size: 20px;
}

.empty-state p {
    margin-bottom: 25px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Responsive Design for Dashboard */
@media (max-width: 1200px) {
    .dashboard-container {
        padding: 15px;
    }

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

@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .user-menu {
        width: 100%;
        justify-content: center;
    }

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

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

    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .year-selector {
        align-self: stretch;
        justify-content: center;
    }

    .habit-header {
        flex-direction: column;
        gap: 15px;
    }

    .habit-streak {
        text-align: left;
    }

    .legend {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 20px;
    }

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

    .calendar-section,
    .progress-overview,
    .habit-card {
        padding: 20px;
    }

    .day-cell {
        font-size: 11px;
    }

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

    .habit-actions {
        flex-direction: column;
    }
}
