@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

:root {
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --accent-green: #30d158;
    --accent-red: #ff453a;
    --accent-yellow: #ffd60a;
    --border-color: #38383a;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    padding: 10px; /* Minimal padding for mobile */
    overflow-x: hidden; /* Prevent horizontal scroll on body */
}

.container { max-width: 600px; margin: 0 auto; }

/* Header Compacto */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 10px;
}

.header-title-group {
    display: flex;
    align-items: center;
}

.app-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    margin-right: 10px;
    object-fit: cover;
}

h1 { font-size: 1.2rem; margin: 0; }

.btn {
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
}
.btn-primary { background: var(--text-primary); color: black; }

/* Habit Card Component */
.habit-card-wrapper {
    position: relative;
    background: var(--accent-red); /* Default background for delete, overridden by inner bg */
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden; /* Clip contents */
}

.habit-card-background {
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    z-index: 1;
}

.swipe-action {
    width: 50%;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}

.action-edit {
    background-color: #0a84ff;
    justify-content: flex-start;
}

.action-delete {
    background-color: var(--accent-red);
    justify-content: flex-end;
}

.habit-card {
    position: relative;
    z-index: 10;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    transition: transform 0.2s ease-out;
    width: 100%;
    touch-action: pan-y; /* Allow vertical scroll, let JS handle horizontal */
}

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

.habit-title {
    font-weight: 600;
    font-size: 1rem;
}

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

/* Days Grid - Optimized for Mobile */
.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
}

.day-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.day-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.status-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2c2c2e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s;
}

.status-circle:active { transform: scale(0.9); }

/* Colors */
.status-done { background: var(--accent-green) !important; color: black; }
.status-missed { background: var(--accent-red) !important; color: white; }
.status-skip { background: rgba(255, 214, 10, 0.2) !important; color: var(--accent-yellow); border: 1px solid rgba(255, 214, 10, 0.3); } /* Translucent yellow */
.status-partial { border: 2px solid var(--accent-green); background: transparent; color: white; }
.current-day-label { color: var(--accent-green); font-weight: bold; }

/* Manage Page Styles */
.form-input {
    width: 100%;
    padding: 15px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    margin-bottom: 15px;
    font-size: 1rem;
}
.label { display: block; margin-bottom: 5px; color: var(--text-secondary); font-size: 0.9rem; }

/* Preset Habits Grid */
.preset-habits-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.preset-habit-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.preset-habit-card:active {
    transform: scale(0.95);
    background: #252527;
}

.preset-habit-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.preset-habit-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.preset-habit-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Streak Badge */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 159, 10, 0.15);
    border: 1px solid rgba(255, 159, 10, 0.3);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ff9f0a;
}

.streak-badge.active {
    background: rgba(48, 209, 88, 0.15);
    border-color: rgba(48, 209, 88, 0.3);
    color: var(--accent-green);
}

/* Weekly Stats */
.weekly-stats-card {
    background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 100%);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 10px;
}

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

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.stat-trend {
    font-size: 0.8rem;
    margin-top: 3px;
}

.trend-up { color: var(--accent-green); }
.trend-down { color: var(--accent-red); }

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    background: var(--card-bg);
    padding: 5px;
    border-radius: 10px;
}

.nav-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-tab.active {
    background: var(--accent-green);
    color: #000;
}

.nav-tab:not(.active):active {
    background: #2c2c2e;
}

/* Calendar View */
.calendar-header {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.calendar-day-header {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding: 5px 0;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: 8px;
    font-size: 0.85rem;
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
}

.calendar-day:active {
    transform: scale(0.95);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.today {
    border: 2px solid var(--accent-green);
}

.calendar-day.perfect {
    background: var(--accent-green);
    color: #000;
    font-weight: 700;
}

.calendar-day.good {
    background: rgba(48, 209, 88, 0.4);
}

.calendar-day.partial {
    background: rgba(255, 214, 10, 0.3);
}

.calendar-day.missed {
    background: rgba(255, 69, 58, 0.2);
}

/* Achievements/Badges */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.achievement-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    position: relative;
}

.achievement-card.unlocked {
    border: 2px solid var(--accent-green);
}

.achievement-card.locked {
    opacity: 0.4;
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    filter: grayscale(1);
}

.achievement-card.unlocked .achievement-icon {
    filter: grayscale(0);
}

.achievement-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.achievement-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.achievement-date {
    font-size: 0.7rem;
    color: var(--accent-green);
    margin-top: 5px;
}

/* Insights */
.insights-card {
    background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 100%);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.insight-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.insight-icon {
    font-size: 1.5rem;
}

.insight-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

.insight-highlight {
    color: var(--accent-green);
    font-weight: 700;
}

/* Floating Button */
.floating-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-green);
    color: #000;
    font-size: 2rem;
    font-weight: 700;
    border: none;
    box-shadow: 0 4px 12px rgba(48, 209, 88, 0.4);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

.floating-btn:active {
    transform: scale(0.9);
    animation: none;
}

.floating-btn:hover {
    box-shadow: 0 6px 20px rgba(48, 209, 88, 0.6);
    animation: none;
}

.floating-btn-icon {
    display: block;
}

.floating-btn-tooltip {
    position: absolute;
    right: 70px;
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.floating-btn:hover .floating-btn-tooltip {
    opacity: 1;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 6px 20px rgba(48, 209, 88, 0.6); }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-color);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    font-size: 1.2rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:active {
    background: var(--card-bg);
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

/* Quick Checkin Items */
.quick-checkin-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.quick-checkin-item:active {
    background: var(--card-bg);
}

.quick-checkin-item.completed {
    opacity: 0.6;
}

.quick-checkin-checkbox {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.quick-checkin-checkbox.checked {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #000;
}

.quick-checkin-info {
    flex: 1;
}

.quick-checkin-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.quick-checkin-progress {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Weekly Graph */
.weekly-graph {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.graph-bars {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 120px;
    padding-bottom: 5px;
}

.graph-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    transition: opacity 0.2s;
}

.graph-day:active {
    opacity: 0.7;
}

.bar-container {
    width: 6px;
    height: 80px;
    background: #333;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.bar-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--accent-green);
    border-radius: 10px;
    transition: height 0.5s ease;
}

.graph-day-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Settings Modal */
.settings-section {
    margin-bottom: 25px;
}

.settings-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.theme-btn:active {
    transform: scale(0.9);
}

.theme-btn.active {
    border-color: white;
}

/* Confetti hidden canvas (handled by lib, but just in case) */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}
/* Premium Styles */
.pro-badge {
    background: linear-gradient(45deg, #ffd60a, #ff9f0a);
    color: black;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-left: 5px;
    display: inline-block;
    vertical-align: middle;
}

.feature-locked {
    opacity: 0.5;
    position: relative;
    pointer-events: none;
}

.feature-locked::after {
    content: "🔒 PRO";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #000;
    color: #ffd60a;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: bold;
    border: 1px solid #ffd60a;
}

.premium-card {
    background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 100%);
    border: 1px solid #ffd60a;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
}

.benefit-list {
    text-align: left;
    margin: 15px 0;
}

.benefit-item {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* Splash Screen / Loader */
#view-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeInScale 0.8s ease-out forwards;
}

.splash-logo {
    width: 120px;
    height: 120px;
    border-radius: 28px;
    margin-bottom: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 4px solid var(--card-bg);
}

.splash-phrase {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 1px;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.4s forwards;
}

.splash-loading-bar {
    width: 150px;
    height: 2px;
    background: var(--card-bg);
    margin: 30px auto 0 auto;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.splash-loading-fill {
    position: absolute;
    width: 60%;
    height: 100%;
    background: var(--accent-green);
    animation: loadingMove 2s infinite ease-in-out;
}

@keyframes fadeInScale {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes loadingMove {
    0% { left: -60%; }
    100% { left: 100%; }
}

/* Transition out */
.splash-fade-out {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease-out, visibility 0.6s;
}


