/* ==========================================================================
   FitTrack Pro - Layouts, Grids & Responsive Structures
   ========================================================================== */

/* Main App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 40%),
                radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.06), transparent 40%),
                var(--bg-main);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    max-width: 1300px;
    width: calc(100% - var(--sidebar-width));
}

#app-content {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Grids & Layout Helpers */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

/* Section Headers & Actions */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dashboard-header p {
    color: var(--text-muted);
}

/* Responsive Layout Overrides (< 768px) */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1.25rem;
        padding-bottom: calc(var(--mobile-nav-height) + 2rem);
    }
}

@media (orientation: landscape) {
    .main-content {
        padding-bottom: 2rem !important;
    }
}

/* Mobile Portrait Responsiveness (< 600px) Layout Spacing */
@media (max-width: 600px) {
    .main-content {
        padding: 0.9rem !important;
        padding-bottom: calc(var(--mobile-nav-height) + 2.5rem) !important;
    }

    .section-header,
    .dashboard-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.85rem !important;
    }

    .section-header .btn,
    .dashboard-header .btn,
    #startWorkoutBtn,
    #finishWorkoutBtn {
        width: 100% !important;
        text-align: center;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
        gap: 0.75rem !important;
    }
}

/* Mobile Screens (< 520px) */
@media (max-width: 520px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}
