/* ============================================
   Habit Tracker - DaisyUI Custom Theme
   Additional custom styles for DaisyUI components
   ============================================ */

/* Custom scrollbar to match dark theme */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: oklch(var(--bc) / 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: oklch(var(--bc) / 0.3);
}

/* Selection color */
::selection {
    background: oklch(var(--p));
    color: oklch(var(--pc));
}

/* Inter font override */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.01em;
}

/* Auth pages centering */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100%;
    padding-bottom: 80px; /* Space for bottom nav */
}

/* Legacy sidebar styles removed - using bottom navigation only */

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 0;
    padding: 1rem;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* Stat Card Water Animation */
.water-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--progress) * 1%);
    background: oklch(var(--in));
    opacity: 0.3;
    transition: height 0.5s ease;
    border-radius: 50%;
}

/* Water Progress Section */
.water-progress-section {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.water-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: oklch(var(--b3));
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Water Chart */
.water-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 180px;
    padding-top: 1.25rem;
}

.chart-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
}

.bar-fill {
    width: 50%;
    background: oklch(var(--in));
    border-radius: 4px 4px 0 0;
    position: relative;
    min-height: 4px;
    opacity: 0.8;
}

/* Habits Grid */
.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Habit Row for full list */
.habits-full-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Streak Days */
.streak-day {
    width: 28px;
    height: 28px;
    border-radius: 0.5rem;
    background: oklch(var(--b3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    color: oklch(var(--bc) / 0.5);
}

.streak-day.completed {
    background: oklch(var(--su) / 0.2);
    color: oklch(var(--su));
}

.streak-day.today {
    box-shadow: inset 0 0 0 2px oklch(var(--p));
}

.streak-day.not-scheduled {
    background: transparent;
    opacity: 0.3;
}

/* Tasks List */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Photos Grid */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.photos-grid-large {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    min-height: 90px;
    padding: 0.5rem;
    background: oklch(var(--b2));
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-day:hover:not(.empty) {
    background: oklch(var(--b3));
}

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

.calendar-day.today {
    box-shadow: inset 0 0 0 2px oklch(var(--p));
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mini-event {
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Weekday Selector */
.weekday-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.weekday-btn {
    position: relative;
    cursor: pointer;
}

.weekday-btn input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.weekday-btn span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: oklch(var(--b3));
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: oklch(var(--bc) / 0.5);
    transition: all 0.2s ease;
}

.weekday-btn input:checked + span {
    background: oklch(var(--p) / 0.2);
    color: oklch(var(--p));
}

.weekday-btn:hover span {
    background: oklch(var(--b3));
    color: oklch(var(--bc));
}

/* Admin Layout */
.admin-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.5rem;
}

/* File Upload Area */
.file-upload {
    position: relative;
    border: 2px dashed oklch(var(--bc) / 0.2);
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: oklch(var(--b3));
}

.file-upload:hover,
.file-upload.drag-over {
    border-color: oklch(var(--p));
    background: oklch(var(--p) / 0.1);
}

.file-upload input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Passkey Dots */
.passkey-dots {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
}

.passkey-dots .dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: oklch(var(--b3));
    transition: all 0.2s ease;
}

.passkey-dots .dot.filled {
    background: oklch(var(--p));
    box-shadow: 0 0 12px oklch(var(--p) / 0.4);
}

/* Mini Photos Grid (Admin) */
.mini-photos-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.mini-photo {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
}

.mini-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   Bottom Navigation (Mobile App Style)
   ============================================ */

nav.bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    background: oklch(var(--b2));
    border-top: 1px solid oklch(var(--b3));
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-around;
    align-items: center;
    padding: 8px 16px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

nav.bottom-nav .nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px;
    padding: 8px 16px;
    border-radius: 12px;
    color: oklch(var(--bc) / 0.5);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
    width: auto !important;
    height: auto !important;
    position: relative;
}

nav.bottom-nav .nav-item span {
    display: block !important;
}

nav.bottom-nav .nav-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

nav.bottom-nav .nav-item.active {
    color: oklch(var(--p));
    background: transparent;
}

nav.bottom-nav .nav-item.active svg {
    stroke: oklch(var(--p));
}

nav.bottom-nav .nav-item:hover {
    background: oklch(var(--b3) / 0.5);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: calc(100% - 32px);
    max-width: 400px;
}

.toast {
    background: oklch(var(--b2));
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid oklch(var(--su));
}

.toast.error {
    border-left: 4px solid oklch(var(--er));
}

/* Water tap animation */
.water-tap-box {
    transition: all 0.2s ease;
}

.water-tap-box:active,
.water-tap-box.tapped {
    transform: scale(0.92);
}

/* Success animation */
.success-pop {
    animation: successPop 0.3s ease;
}

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

/* ============================================
   Mobile Responsiveness
   ============================================ */

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

@media (max-width: 1024px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

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

    .mini-photos-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    /* Hide desktop sidebar on mobile */
    .sidebar:not(.bottom-nav) {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-bottom: 100px; /* Space for bottom nav */
    }

    .page-header {
        flex-direction: column;
    }

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

    .calendar-day {
        min-height: 50px;
        padding: 4px;
    }

    .day-events {
        display: none;
    }

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

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

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .photos-grid-large {
        grid-template-columns: 1fr;
    }

    .water-circle {
        width: 160px;
        height: 160px;
    }
}

/* Touch device hover fix */
@media (hover: none) {
    .nav-item[title]:hover::after {
        display: none;
    }
}

/* Safe area for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .main-content {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
