/* =========================================
   Habits Page (Alışkanlıklar) Stilleri (Notion Style)
   ========================================= */

/* --- Habits Ozet Alani (Stats Boxes) - Bento Grid --- */
.habits-summary-banner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.habits-stat-box {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.habits-stat-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.habits-stat-content {
    display: flex;
    flex-direction: column;
}

.habits-stat-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.habits-stat-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.habits-stat-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.ai-prediction-box {
    border-color: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

/* Dinamik AI Durum Renkleri */
.ai-status-good {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    border-color: rgba(16, 185, 129, 0.3);
}
.ai-status-good .ai-glow {
    color: #10b981;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.8));
    animation: pulseGlowGood 2s infinite alternate;
}

.ai-status-warn {
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
    border-color: rgba(245, 158, 11, 0.3);
}
.ai-status-warn .ai-glow {
    color: #f59e0b;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.8));
    animation: pulseGlowWarn 2s infinite alternate;
}

.ai-status-risk {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    border-color: rgba(239, 68, 68, 0.3);
}
.ai-status-risk .ai-glow {
    color: #ef4444;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.8));
    animation: pulseGlowRisk 2s infinite alternate;
}

@keyframes pulseGlowGood {
    from { filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.5)); }
    to { filter: drop-shadow(0 0 12px rgba(16, 185, 129, 1)); }
}
@keyframes pulseGlowWarn {
    from { filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.5)); }
    to { filter: drop-shadow(0 0 12px rgba(245, 158, 11, 1)); }
}
@keyframes pulseGlowRisk {
    from { filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.5)); }
    to { filter: drop-shadow(0 0 12px rgba(239, 68, 68, 1)); }
}

@media (max-width: 900px) {
    .habits-summary-banner {
        grid-template-columns: 1fr 1fr;
    }
    .ai-prediction-box {
        grid-column: 1 / -1;
    }
}
@media (max-width: 600px) {
    .habits-summary-banner {
        grid-template-columns: 1fr;
    }
}

/* --- Kategoriler --- */
.habit-category-group {
    margin-bottom: 24px;
}
.habit-category-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.habit-category-title::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: var(--accent);
}

.habits-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- Habit Card (Row in Grid) --- */
.habit-card {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px 20px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.habit-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255,255,255, 0.02);
}

/* Left: Info */
.habit-info {
    flex: 0 0 250px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 20px;
}

.habit-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.habit-emoji {
    font-size: 1.2rem;
}

.habit-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.habit-streak {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.habit-streak svg {
    width: 14px;
    height: 14px;
    stroke: #f59e0b;
}

.habit-tags {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.habit-difficulty {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}
.difficulty-easy { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.difficulty-medium { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.difficulty-hard { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* Progress Bar (Habit Altı) */
.habit-progress-bar-wrapper {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}
.habit-progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Middle: Days */
.habit-days {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.habit-day-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.habit-day-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* State Buttons */
.habit-check-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px; /* Karemsi yuvarlak yapı Notion tarzı */
    border: 2px solid var(--sidebar-border);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.habit-check-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* State: None (Boş) */
.habit-check-btn.state-none {
    color: transparent;
}
.habit-check-btn.state-none:hover:not(.future) {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
}

/* State: Completed (Canlı Yeşil) */
.habit-check-btn.state-completed {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

/* State: Partial (Yarıda Kaldı/Turuncu) */
.habit-check-btn.state-partial {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fbd38d;
}

/* State: Postponed (Ertelendi/Gri) */
.habit-check-btn.state-postponed {
    background: rgba(156, 163, 175, 0.2);
    border-color: #9ca3af;
    color: #d1d5db;
}

.habit-check-btn.future {
    opacity: 0.2;
    cursor: not-allowed;
}

/* Right: Actions */
.habit-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    padding-left: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.habit-card:hover .habit-actions {
    opacity: 1;
}

.habit-focus-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.habit-focus-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.habit-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.habit-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}
.habit-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

@media (max-width: 900px) {
    .habit-card {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .habit-info {
        flex: none;
        padding-right: 0;
    }
    .habit-days {
        justify-content: space-between;
    }
    .habit-actions {
        padding-left: 0;
        justify-content: flex-end;
        opacity: 1;
    }
}

/* --- Heatmap (Isı Haritası) --- */
.habits-heatmap-container {
    margin-top: 40px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
}
.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.heatmap-header h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
}
.heatmap-total {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(30, 1fr);
    gap: 4px;
    margin-bottom: 16px;
}

/* GitHub Heatmap Colors */
.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05); /* Level 0 */
}
.heatmap-cell.level-1 { background: #0e4429; }
.heatmap-cell.level-2 { background: #006d32; }
.heatmap-cell.level-3 { background: #26a641; }
.heatmap-cell.level-4 { background: #39d353; }

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    justify-content: flex-end;
}
.heatmap-legend .heatmap-cell {
    width: 12px;
    height: 12px;
}

@media (max-width: 768px) {
    .heatmap-grid {
        grid-template-columns: repeat(15, 1fr);
    }
}

/* --- AI Mentor Bubble --- */
.ai-mentor-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(20, 10, 30, 0.95);
    border: 1px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    width: 320px;
    z-index: 1000;
    transform: translateY(0);
    animation: bubbleFloat 6s ease-in-out infinite;
}

@keyframes bubbleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.ai-mentor-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ai-mentor-avatar svg {
    width: 20px;
    height: 20px;
}

.ai-mentor-bubble-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-mentor-bubble-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #38bdf8;
}

.ai-mentor-bubble-content p {
    font-size: 0.9rem;
    color: #fff;
    line-height: 1.4;
}

.ai-mentor-bubble-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}
.ai-mentor-bubble-close:hover {
    color: #fff;
}

/* --- Habit Detail Modal --- */
.habit-detail-modal {
    max-width: 500px;
    width: 90%;
}

.habit-detail-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 10px;
}

.hd-stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hd-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.hd-stat-val {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.hd-mini-heatmap {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    gap: 4px;
}

.hd-trend-up { color: #10b981; }
.hd-trend-down { color: #ef4444; }
.hd-trend-flat { color: #9ca3af; }

@media (max-width: 500px) {
    .hd-mini-heatmap {
        grid-template-columns: repeat(15, 1fr);
    }
}
