/* === TakeoutKit App Styles === */
/* Mobile-first, matching landing page dark theme */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-deep: #0a0e1a;
    --bg-card: #111827;
    --bg-elevated: #1a2236;
    --accent: #22d3ee;
    --accent-dim: rgba(34, 211, 238, 0.12);
    --accent-glow: rgba(34, 211, 238, 0.25);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.08);
    --gradient-start: #22d3ee;
    --gradient-end: #818cf8;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    min-height: 100dvh;
}

/* === AMBIENT BACKGROUND === */
.ambient {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
}
.ambient::before {
    content: '';
    position: absolute;
    top: -30%; left: -20%;
    width: 70vw; height: 70vw;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.06) 0%, transparent 65%);
    animation: drift 25s ease-in-out infinite alternate;
}
.ambient::after {
    content: '';
    position: absolute;
    bottom: -20%; right: -15%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.05) 0%, transparent 60%);
    animation: drift 30s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(5vw, 3vh); }
}

.app-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* === HEADER === */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    position: sticky;
    top: 0;
    background: rgba(10, 14, 26, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    margin: 0 -16px;
    padding: 16px;
}

.app-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-decoration: none;
}
.app-logo span { color: var(--accent); }

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-back:hover { border-color: var(--accent); color: var(--accent); }
.btn-back svg { width: 16px; height: 16px; }

.btn-new {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-new:hover { border-color: var(--danger); color: var(--danger); }

/* === SCREENS === */
.screen { display: none; }
.screen.active { display: block; }

/* === UPLOAD SCREEN === */
.upload-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    min-height: calc(100dvh - 80px);
    text-align: center;
    padding: 20px 0;
}

.upload-hero h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}
.upload-hero h1 em {
    font-style: normal;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.upload-hero p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 32px;
    max-width: 400px;
}

.drop-zone {
    width: 100%;
    max-width: 480px;
    border: 2px dashed rgba(148, 163, 184, 0.15);
    border-radius: 16px;
    padding: 48px 24px;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-card);
    position: relative;
    overflow: hidden;
}
.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(34, 211, 238, 0.04);
}
.drop-zone.drag-over {
    transform: scale(1.02);
}

.drop-zone-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: var(--accent-dim);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.drop-zone h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.drop-zone p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-privacy {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.upload-privacy svg { width: 14px; height: 14px; flex-shrink: 0; }

/* === PROGRESS SCREEN === */
.progress-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    min-height: calc(100dvh - 80px);
    text-align: center;
}

.progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 32px;
    width: 100%;
    max-width: 420px;
}

.progress-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-card h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.progress-card .progress-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.progress-bar-container {
    background: var(--bg-elevated);
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-detail {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* === DASHBOARD SCREEN === */
.dashboard-screen {
    padding: 8px 0 40px;
}

.dashboard-summary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 24px;
}
.dashboard-summary h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.dashboard-summary p {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.dashboard-stats {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-elevated);
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.stat-chip strong {
    color: var(--accent);
    font-family: 'Space Grotesk', sans-serif;
}

.category-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
    -webkit-tap-highlight-color: transparent;
}
.category-card:hover,
.category-card:active {
    border-color: rgba(34, 211, 238, 0.2);
    transform: translateY(-1px);
}

.category-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.category-info { flex: 1; min-width: 0; }
.category-info h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}
.category-info p {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.category-count {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 4px 10px;
    border-radius: 6px;
    flex-shrink: 0;
}

.category-arrow {
    color: var(--text-muted);
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* === VIEWER SCREEN === */
.viewer-screen {
    padding: 8px 0 40px;
}

.viewer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.viewer-header .category-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
}
.viewer-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
}
.viewer-header .viewer-count {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-left: auto;
    font-family: 'Space Grotesk', sans-serif;
}

/* === SEARCH BAR === */
.search-bar {
    position: relative;
    margin-bottom: 16px;
}
.search-bar input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px 12px 40px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.search-bar input:focus {
    border-color: var(--accent);
}
.search-bar input::placeholder {
    color: var(--text-muted);
}
.search-bar svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

/* === FILTER TABS === */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
    padding: 6px 14px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
}
.filter-tab.active {
    background: var(--accent-dim);
    border-color: rgba(34, 211, 238, 0.25);
    color: var(--accent);
}

/* === ITEMS LIST === */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s;
}
.item-card:hover {
    border-color: rgba(148, 163, 184, 0.15);
}

.item-card .item-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.35;
    word-break: break-word;
}
.item-card .item-title a {
    color: var(--text-primary);
    text-decoration: none;
}
.item-card .item-title a:hover {
    color: var(--accent);
}

.item-card .item-subtitle {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-bottom: 6px;
    line-height: 1.4;
    word-break: break-word;
}

.item-card .item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.item-card .item-meta span {
    color: var(--text-muted);
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 4px;
}
.item-card .item-meta .tag {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 500;
}

/* === MAP CONTAINER === */
.map-container {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.map-container .leaflet-container {
    height: 100%;
    width: 100%;
    background: var(--bg-deep);
}

/* === CONTACT CARD === */
.contact-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.contact-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--bg-deep);
    flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-info .contact-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 2px;
}
.contact-info .contact-detail {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === CALENDAR EVENT === */
.event-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 14px;
}
.event-date {
    text-align: center;
    min-width: 48px;
    flex-shrink: 0;
}
.event-date .event-month {
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}
.event-date .event-day {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}
.event-info { flex: 1; }
.event-info .event-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 4px;
}
.event-info .event-time {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-bottom: 2px;
}
.event-info .event-location {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* === FIT METRICS === */
.fit-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.fit-date {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-secondary);
}
.fit-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.fit-metric {
    text-align: center;
}
.fit-metric .fit-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}
.fit-metric .fit-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* === LOAD MORE === */
.load-more {
    text-align: center;
    padding: 20px;
}
.load-more button {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.load-more button:hover {
    background: var(--accent-dim);
    border-color: rgba(34, 211, 238, 0.25);
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}
.empty-state p {
    font-size: 0.9rem;
}

/* === ERROR STATE === */
.error-banner {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    color: #fca5a5;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === DATE GROUP === */
.date-group {
    margin-bottom: 8px;
}
.date-group-header {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 0 8px;
    position: sticky;
    top: 56px;
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10;
}

/* === RESPONSIVE === */
@media (min-width: 480px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .fit-metrics {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) {
    .app-content {
        padding: 0 24px;
    }
    .map-container {
        height: 400px;
    }
}

/* === UTILITY === */
.hidden { display: none !important; }

/* Leaflet dark theme overrides */
.leaflet-tile-pane { filter: brightness(0.85) contrast(1.1) saturate(0.8); }
.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}
.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4) !important;
}
.leaflet-popup-tip { background: var(--bg-card) !important; }
