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

:root {
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --glass: rgba(255, 255, 255, 0.03);

    /* Apple Health Inspired Palette */
    --health-red: #ff3b30;
    --health-orange: #ff9500;
    --health-yellow: #ffcc00;
    --health-green: #34c759;
    --health-teal: #5ac8fa;
    --health-blue: #007aff;
    --health-indigo: #5856d6;
    --health-purple: #af52de;
    --health-pink: #ff2d55;

    --success: var(--health-green);
    --error: var(--health-red);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.brand {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

/* Glass Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: 20px;
    /* Slightly tighter radius for HA look */
    padding: 20px;
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* HomeAssistant-Style Chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    transition: all 0.2s;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.chip-icon {
    font-size: 1rem;
    opacity: 0.9;
}

/* Vertical and Horizontal Stacks */
.h-stack {
    display: flex;
    flex-direction: row;
    gap: 12px;
    flex-wrap: wrap;
}

.v-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Glance Card (HA Style) */
.glance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
}

.glance-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.glance-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
}

.glance-item .value {
    font-size: 0.95rem;
    font-weight: 700;
}

/* App-wide Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 35px 0 15px 0;
}

.section-header h3 {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* Apple-Style Metric Cards */
.metric-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
}

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

.metric-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    line-height: 1;
}

.metric-unit {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}

.metric-footer {
    margin-top: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Health Coloring Classes */
.text-weight {
    color: var(--health-blue);
}

.text-fat {
    color: var(--health-orange);
}

.text-med {
    color: var(--health-purple);
}

.text-tape {
    color: var(--health-pink);
}

.text-exercise {
    color: var(--health-green);
}

/* Checklist Style (Apple Reminders) */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

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

.checklist-checkbox.checked {
    background: var(--health-green);
    border-color: var(--health-green);
}

.checklist-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Horizontal Gallery */
.photo-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
    /* Firefox */
}

.photo-strip::-webkit-scrollbar {
    display: none;
}

/* Chrome/Safari */

.photo-tile {
    flex: 0 0 calc(50% - 6px);
    aspect-ratio: 4/5;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}

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

/* Modern Input */
input,
select {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 20px;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

/* Premium Button */
.btn-premium {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-premium:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(124, 58, 237, 0.5);
}

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

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px;
}

.grid {
    display: grid;
    gap: 24px;
}

/* Transitions */
.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}