/* PawLog Layout CSS - Screen Structure, Navigation, Responsive */

/* ============================================================================
   Header
   ============================================================================ */

header {
    background: var(--color-surface);
    padding: 1rem 1rem;
    padding-top: calc(1rem + var(--safe-area-top));
    border-bottom: 1px solid var(--color-border);
}

.header-content {
    max-width: var(--container-max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: var(--color-text);
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

#profile-greeting {
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
}

/* ============================================================================
   Main Content
   ============================================================================ */

main {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.main-content {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
    padding-bottom: calc(100px + var(--safe-area-bottom));
}

/* ============================================================================
   Bottom Navigation - Mobile Only
   ============================================================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + var(--safe-area-bottom));
    box-shadow: 0 -1px 0 var(--color-border);
    z-index: 1000;
    border-top: 1px solid var(--color-border);
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.625rem 1rem;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: color 0.2s;
    font-size: 0.625rem;
    font-weight: 500;
    min-height: 56px;
}

.nav-btn:hover,
.nav-btn.active {
    color: var(--color-primary);
}

.nav-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

/* Desktop: hide bottom nav */
@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
}

/* ============================================================================
   Side Menu (Desktop)
   ============================================================================ */

.side-menu {
    display: none;
}

@media (min-width: 768px) {
    .side-menu {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 220px;
        background: var(--color-surface);
        border-right: 1px solid var(--color-border);
        padding: 1rem;
        padding-top: calc(1rem + var(--safe-area-top));
        z-index: 100;
    }

    .side-menu-header {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .side-menu-logo {
        width: 40px;
        height: 40px;
        object-fit: contain;
        border-radius: 50%;
    }

    .side-menu-header h1 {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--color-text);
    }

    .side-nav-btn {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.875rem 1rem;
        background: transparent;
        border: none;
        border-radius: 12px;
        cursor: pointer;
        color: var(--color-text-secondary);
        transition: all 0.2s;
        margin-bottom: 0.25rem;
        font-size: 0.9375rem;
        font-weight: 500;
    }

    .side-nav-btn:hover {
        background: var(--color-background);
        color: var(--color-text);
    }

    .side-nav-btn.active {
        background: var(--color-tint);
        color: var(--color-primary);
    }

    .side-nav-btn .nav-icon {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }

    /* Hide global bottom nav on desktop */
    #global-bottom-nav {
        display: none;
    }

    /* Offset main content for side menu */
    #dashboard,
    #profile-screen,
    #diary-screen,
    #trainer-screen,
    #kb-screen,
    #meal-screen {
        margin-left: 220px;
        padding-bottom: 2rem;
    }
}

/* ============================================================================
   Back Button
   ============================================================================ */

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-primary);
    flex-shrink: 0;
    transition: background 0.2s;
}

.back-btn:hover {
    background: var(--color-background);
}

.back-btn:active {
    transform: scale(0.95);
}

.back-btn svg {
    width: 24px;
    height: 24px;
}

/* ============================================================================
   Quick Actions
   ============================================================================ */

.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .quick-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    main {
        padding: 0 1rem;
    }
}

/* ============================================================================
   Reduce Motion (Accessibility)
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {

    .event-trainer-badge,
    .day-subtitle,
    .event-metadata-row {
        transition: none;
    }

    .event-item:hover {
        transform: none;
    }

    .event-metadata-row:active {
        transform: none;
    }
}