:root {
    --bg-base: #0f172a;
    /* Slate 900 */
    --primary: #8b5cf6;
    /* Violet 500 */
    --primary-glow: rgba(139, 92, 246, 0.5);
    --secondary: #06b6d4;
    /* Cyan 500 */

    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-glow: rgba(255, 255, 255, 0.05);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background Animated Mesh */
.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.15), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.15), transparent 40%);
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -200px;
    left: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% {
        transform: translateY(0px) scale(1);
    }

    100% {
        transform: translateY(50px) scale(1.1);
    }
}

/* Navigation */
.glass-nav {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 0;
}

.nav-container {
    width: 95%;
    margin: 0;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    /* Removed overflow: hidden so search dropdown can break out */
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
    min-width: 0;
    /* Allow contraction */
}

.brand-text {
    flex-shrink: 0;
}

.brand-subtitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.pulse-icon {
    color: var(--primary);
    animation: pulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        text-shadow: 0 0 15px var(--primary-glow);
    }

    50% {
        opacity: .5;
        text-shadow: none;
    }
}

.date-badge {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    /* Never shrink or overflow */
    white-space: nowrap;
}

/* Global Progress Bar */
.loading-progress-container {
    position: relative;
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: opacity 0.5s ease;
}

.loading-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.5), rgba(139, 92, 246, 0.5));
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    transition: width 0.3s ease;
}

.loader-text {
    position: relative;
    z-index: 2;
    padding-left: 20px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.05em;
}

/* Global Activity Bar (Refined) */
.global-activity-bar {
    width: 100%;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-container {
    display: flex;
    gap: 2rem;
}

.stat-item {
    display: flex;
    align-items: center;
}

.stat-item .count {
    font-size: 1.25rem;
    font-weight: 700;
    margin-right: 0.5rem;
    margin-left: 0.5rem;
}

.stat-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.5;
}

.activity-container {
    width: 100%;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.activity-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
}

.activity-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.1);
}

.activity-item .count {
    font-weight: 800;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.activity-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Weekly Trend Section */
.weekly-trend-section {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
}

.trend-card {
    padding: 1.25rem;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.3);
}

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

.trend-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.02em;
}

/* Container */
.container {
    width: 100%;
    margin: 0;
    padding: 1rem 1.5rem 5rem 1.5rem;
    flex: 1;
    overflow-x: hidden;
}

.header {
    margin-bottom: 1.5rem;
    text-align: left;
    /* Aligned left as requested */
}

.search-container {
    max-width: 50%;
    margin-right: auto;
    /* Aligned left */
    margin-left: 0;
    margin-bottom: 2rem;
}

.glow-text {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 30px rgba(139, 92, 246, 0.3));
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem !important;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Grid & Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    width: 90%;
    margin: 0 auto;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    /* Top light reflection */
    border-radius: 20px;
    padding: 1.75rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 24px -1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.03), transparent);
    transform: skewX(-20deg);
    transition: all 0.7s;
}

.glass-card:hover::before {
    left: 200%;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.4), 0 0 20px 0 rgba(139, 92, 246, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* User Avatar & Sync Dot */
.user-avatar-container {
    position: relative;
    width: 60px;
    height: 60px;
    margin-right: 1.5rem;
}

.user-avatar {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.sync-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #475569; /* Gray while syncing */
    border: 3px solid #0f172a;
    border-radius: 50%;
    transition: all 0.5s ease;
    z-index: 10;
}

.sync-dot.synced {
    background: #10b981; /* Neon Green */
    box-shadow: 0 0 10px #10b981;
}

.sync-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #10b981;
    opacity: 0;
    pointer-events: none;
}

.sync-dot.synced::after {
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.user-info {
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.user-info h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.user-info .email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.effort-badges {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.effort-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.2s ease;
}

.effort-badge:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.08);
}

.effort-badge i {
    font-size: 0.9rem;
}

/* Footer & Status */
.card-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
}

.synced-badge {
    font-size: 0.75rem;
    color: #10b981;
    /* Emerald 500 */
    background: rgba(16, 185, 129, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

footer {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.875rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}


/* --- Utilities / Tailwind replacements for generated Python HTML --- */
.space-y-6>*+* {
    margin-top: 1.5rem;
}

.tracking-wider {
    letter-spacing: 0.05em;
}

.uppercase {
    text-transform: uppercase;
}

.text-sm {
    font-size: 0.875rem;
}

.text-teal-400 {
    color: #2dd4bf;
}

.text-teal-500 {
    color: #14b8a6;
}

.text-purple-400 {
    color: #c084fc;
}

.text-purple-500 {
    color: #a855f7;
}

.text-red-500 {
    color: #ef4444;
}

.text-red-400 {
    color: #f87171;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-300 {
    color: #d1d5db;
}

.text-gray-100 {
    color: #f3f4f6;
}

.text-blue-400 {
    color: #60a5fa;
    text-decoration: none;
}

.text-blue-400:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.italic {
    font-style: italic;
}

.list-disc {
    list-style-type: disc;
}

.pl-5 {
    padding-left: 1.25rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

/* --- Material 3 / Glassmorphism Forms --- */
.form-card {
    padding: 1.5rem 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.subsection-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary);
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.manual-form {
    width: 100%;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group.shrink {
    flex: 1 1 200px;
    max-width: 250px;
}

.input-group.grow {
    flex: 3 1 300px;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.glass-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.glass-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Material 3 Focus Effect */
.glass-input:focus {
    outline: none;
    background: rgba(15, 23, 42, 0.6);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* For date inputs specifically to invert color scheme of calendar popup icon */
.glass-input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.7);
    cursor: pointer;
}

.glass-input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: invert(1) opacity(1);
}

.glass-btn {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.glass-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
    background: linear-gradient(135deg, #0891b2, #7c3aed);
    /* slightly darker/more intense on hover */
}

.glass-btn:active {
    transform: translateY(0);
}

/* Mini Form inside Card */
.mini-manual-form {
    width: 100%;
    margin-top: 1.25rem;
    /* More space from badges */
}

.mini-manual-form .input-group {
    position: relative;
    width: 100%;
    max-width: 280px;
    /* Slimmer look */
}

.glass-input.mini {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.3);
}

.mini-send-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.6;
    padding: 4px;
    transition: all 0.2s ease;
}

.mini-send-btn:hover {
    opacity: 1;
    color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

/* Manual Logs Pending List UI */
.mt-6 {
    margin-top: 1.5rem;
}

.text-xs {
    font-size: 0.75rem;
}

.flex-col {
    flex-direction: column;
}

.gap-2 {
    gap: 0.5rem;
}

.ml-auto {
    margin-left: auto;
}

.manual-log-item {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.manual-log-item:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
}

.log-date {
    color: var(--secondary);
    font-weight: 600;
    margin-right: 1rem;
    opacity: 0.8;
}

.log-title {
    color: var(--text-main);
}

.delete-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    /* red-500 */
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    opacity: 0.6;
    transition: all 0.2s;
}

.delete-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

/* Skeleton Loading Animations */
.loading-skeleton {
    padding: 1rem 0;
}

.skeleton-line {
    height: 12px;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.05),
            transparent);
    animation: shimmer 1.5s infinite;
}

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

    100% {
        transform: translateX(100%);
    }
}

.synced-badge i.fa-spin {
    margin-right: 0.5rem;
}

/* Story Comment Groups */
.collapsed {
    max-height: 0 !important;
    opacity: 0;
    margin: 0 !important;
    padding: 0 !important;
}

ul:not(.collapsed) {
    max-height: 2000px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}