:root {
    --bg-dark: #0a0f14;
    --bg-card: rgba(255, 255, 255, 0.05);
    --accent-primary: #00d1b2;
    /* Mint green */
    --accent-secondary: #4a90e2;
    /* Sky blue */
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --danger: #ff4757;
    --success: #2ed573;

    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);

    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: calc(80px + var(--safe-area-bottom));
}

/* Header Styles */
.app-header {
    background: linear-gradient(to bottom, var(--bg-dark), rgba(10, 15, 20, 0.8));
    backdrop-filter: var(--glass-blur);
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.greeting {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 300;
}

h1 {
    font-size: 1.4rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 5px;
}

.ai-pulse {
    width: 12px;
    height: 12px;
    background-color: var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 209, 178, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(0, 209, 178, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 209, 178, 0);
    }
}

/* Main Content Area */
#main-content {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 20, 25, 0.9);
    backdrop-filter: var(--glass-blur);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0 calc(5px + var(--safe-area-bottom));
    border-top: 1px solid var(--glass-border);
    z-index: 1000;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: color 0.3s;
    width: 20%;
}

.nav-item.active {
    color: var(--accent-primary);
}

.nav-item svg {
    transition: transform 0.3s;
}

.nav-item:active svg {
    transform: scale(0.8);
}

.fab-item {
    position: relative;
    top: -15px;
}

.fab {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    box-shadow: 0 10px 20px rgba(0, 209, 178, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
}

.fab:active {
    transform: scale(0.9) rotate(90deg);
}

/* Utilities */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Checkbox Grid for Goals */
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.checkbox-item input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 18px;
    height: 18px;
}

.checkbox-item span {
    font-size: 0.85rem;
    color: var(--text-main);
}

.tag-success {
    background: rgba(46, 213, 115, 0.2) !important;
    border: 1px solid var(--success);
    color: var(--success) !important;
}

/* Diary Styles */
.diary-day {
    margin-bottom: 30px;
}

.diary-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-left: 5px;
}

.diary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 10px;
}

.diary-item-info {
    display: flex;
    flex-direction: column;
}

.diary-item-info strong {
    font-size: 1rem;
}

.diary-item-info small {
    font-size: 0.75rem;
}

.diary-item-calories {
    font-weight: 700;
    color: var(--accent-primary);
}

.diary-summary {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 5px 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.diary-summary strong {
    color: var(--text-main);
}

/* Diary Entry Card Styles */
.diary-entry {
    padding: 15px;
    margin-bottom: 15px;
}

.diary-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.diary-badge {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #000;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.diary-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.diary-photo-link {
    display: inline-block;
    color: var(--accent-primary);
    font-size: 0.8rem;
    text-decoration: none;
    margin-bottom: 8px;
}

.diary-photo-link:hover {
    text-decoration: underline;
}

.diary-entry-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.diary-calories {
    font-weight: 700;
    color: var(--accent-primary);
}

.diary-entry-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.text-btn-small {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.text-btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
}

.text-btn-small.danger {
    color: var(--danger);
}

.text-btn-small.danger:hover {
    background: rgba(255, 71, 87, 0.2);
}

/* Average Card Styles */
.avg-card {
    text-align: center;
    padding: 40px 25px;
}

.avg-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin: 15px 0;
}

.avg-value small {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

.avg-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.avg-status {
    font-size: 0.9rem;
    padding: 10px 15px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
}

.avg-status.success {
    background: rgba(46, 213, 115, 0.15);
    color: var(--success);
}

.avg-status.warning {
    background: rgba(255, 71, 87, 0.15);
    color: var(--danger);
}