/* Custom styles for Inglewood Fitness Club */

:root {
    --gym-primary: #ff6b35;
    --gym-secondary: #f7931e;
    --gym-accent: #2c3e50;
    --gym-dark: #1a1a1a;
    --primary-gradient: linear-gradient(135deg, var(--gym-primary) 0%, var(--gym-secondary) 100%);
    --hero-bg: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(247, 147, 30, 0.1) 100%);
}

/* Admin Posts and Comments Styling */
.admin-post {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.05) 0%, rgba(247, 147, 30, 0.05) 100%);
    border-left: 4px solid var(--gym-primary);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.1);
}

.admin-comment {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.08) 0%, rgba(247, 147, 30, 0.08) 100%) !important;
    border-left: 3px solid var(--gym-primary) !important;
}

/* Navbar Home Icon */
.navbar-home-icon {
    font-size: 1.8rem;
    color: var(--gym-primary);
    transition: color 0.3s ease, transform 0.2s ease;
}

.navbar-home-icon:hover {
    color: var(--gym-secondary);
    transform: scale(1.1);
}

/* Hero Title Image */
.hero-title-img {
    max-width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    border: 4px solid var(--gym-primary);
}

/* Hero Section */
.hero-section {
    background: var(--hero-bg);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
}

/* Hero Gym Image */
.hero-gym-image {
    max-height: 800px;
    width: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 3px solid var(--gym-primary);
}

.hero-gym-image:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 40px rgba(255, 107, 53, 0.3) !important;
}

.hero-icon {
    font-size: 12rem;
    color: var(--gym-primary);
    opacity: 0.2;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* Feature Cards */
.feature-card {
    border: none;
    background: rgba(var(--bs-body-bg-rgb), 0.8);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid var(--gym-primary);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(255, 107, 53, 0.2);
    border-left-color: var(--gym-secondary);
}

.feature-icon {
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.1);
}

.feature-icon i {
    color: var(--gym-primary);
}

/* CTA Section */
.cta-section {
    background: var(--primary-gradient);
    color: white;
}

.cta-section .btn-light {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Equipment Cards */
.equipment-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-top: 3px solid var(--gym-primary);
}

.equipment-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.2);
    border-top-color: var(--gym-secondary);
}

.equipment-image {
    height: 200px;
    object-fit: cover;
}

.equipment-placeholder {
    height: 200px;
    background: rgba(var(--bs-secondary-rgb), 0.1);
}

/* Video Container */
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    border-radius: 0.375rem;
}

.responsive-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0.375rem;
}

/* Instructions and Safety Tips */
.instructions-content .list-group-item {
    border: none;
    background: rgba(var(--bs-primary-rgb), 0.05);
    margin-bottom: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
}

.instructions-content .list-group-item:hover {
    background: rgba(var(--bs-primary-rgb), 0.1);
}

.safety-content .list-group-item {
    border: none;
    background: rgba(var(--bs-warning-rgb), 0.05);
    margin-bottom: 0.5rem;
    border-radius: 0.375rem;
    border-left: 4px solid var(--bs-warning);
}

/* Category Filters */
.category-filter {
    transition: all 0.2s ease;
}

.category-filter.active {
    background-color: var(--gym-primary);
    border-color: var(--gym-primary);
    color: white;
}

.category-filter:not(.active):hover {
    background-color: rgba(255, 107, 53, 0.1);
    border-color: var(--gym-primary);
    color: var(--gym-primary);
}

/* Navigation — logo art is transparent-background, so the bars use the app's
   own dark chrome and the logo sits on it with nothing to blend */
.navbar {
    backdrop-filter: blur(10px);
    background: rgba(var(--bs-dark-rgb), 0.95) !important;
}

.navbar-brand {
    font-size: 1.5rem;
}

/* Footer */
footer {
    background: rgba(var(--bs-dark-rgb), 0.95);
}

/* Admin Panel */
.admin-form {
    background: rgba(var(--bs-body-bg-rgb), 0.8);
    backdrop-filter: blur(10px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-icon {
        font-size: 8rem;
    }
    
    .display-4 {
        font-size: 2.5rem;
    }
    
    .category-filter {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Loading states */
.equipment-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.equipment-item.hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-secondary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}

/* Focus states for accessibility — :focus for text inputs only (they keep
   focus while typing). Buttons use :focus-visible in the button system below
   so a mouse click never leaves a persistent halo. */
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 107, 53, 0.25);
}

/* Override Bootstrap primary colors */
.text-primary {
    color: var(--gym-primary) !important;
}

.bg-primary {
    background-color: var(--gym-primary) !important;
}

.border-primary {
    border-color: var(--gym-primary) !important;
}

.badge.bg-primary {
    background-color: var(--gym-primary) !important;
}

/* Social Media Links */
.social-link {
    color: var(--gym-primary);
    transition: color 0.3s ease;
}

.social-link:hover {
    color: var(--gym-secondary);
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    footer {
        display: none;
    }
    
    .hero-section {
        background: none;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
}

/* ============================================================
   App shell — mobile-first layout (bottom tabs + slim top bar)
   Desktop keeps a classic top navbar.
   ============================================================ */

:root {
    --tabbar-h: 60px;
    --topbar-h: 70px;
}

/* --- Mobile top bar --- */
.app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* Bar grows to include the iPhone notch/Dynamic Island area so the
       logo and buttons always get the full --topbar-h of usable space */
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top);
    background: rgba(var(--bs-dark-rgb), 0.97);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1030;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.3px;
}

.app-brand i {
    color: var(--gym-primary);
}

.app-brand:hover { color: #fff; }

.app-topbar-icon {
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.15rem;
    padding: 10px;
    text-decoration: none;
}

.app-topbar-icon:hover { color: var(--gym-primary); }

.app-topbar-icon + .app-topbar-icon { margin-left: 2px; }

/* --- Mobile bottom tab bar --- */
.app-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: rgba(var(--bs-dark-rgb), 0.97);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom);
}

.app-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--tabbar-h);
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 0.68rem;
    line-height: 1.1;
    -webkit-tap-highlight-color: transparent;
}

.app-tab i { font-size: 1.2rem; }

.app-tab:hover { color: rgba(255, 255, 255, 0.85); }

.app-tab.active {
    color: var(--gym-primary);
}

/* --- Brand logo (club logo in top bars) --- */
.brand-logo {
    height: 60px;
    width: auto;
    display: block;
    /* Soft shadow lifts the white/orange art off the dark bar */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}

.navbar .brand-logo {
    height: 80px;
}

@media (min-width: 768px) {
    .navbar .brand-logo {
        height: 96px;
    }
}

/* --- Body spacing + shell visibility --- */
@media (max-width: 767.98px) {
    body.app-shell {
        padding-top: calc(var(--topbar-h) + env(safe-area-inset-top));
        padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
    }

    body.app-shell footer {
        font-size: 0.85rem;
    }

    body.app-shell footer .footer-info {
        display: none;
    }

    /* Tighten page content on phones */
    body.app-shell main > .container,
    body.app-shell main .container {
        padding-left: 14px;
        padding-right: 14px;
    }
}

@media (min-width: 768px) {
    .app-topbar,
    .app-tabbar {
        display: none !important;
    }
}

/* Cookie consent banner: on phones it must stack ABOVE the fixed bottom tab
   bar (which only exists for logged-in members — body.app-shell), otherwise
   it covers all five tabs until dismissed. Desktop and guests stay
   bottom-anchored. */
@media (max-width: 767.98px) {
    body.app-shell .cookie-consent {
        bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* --- Desktop navbar brand --- */
.navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.navbar .navbar-brand i {
    color: var(--gym-primary);
    font-size: 1.3rem;
}

.navbar .nav-link {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
}

.navbar .nav-link.active {
    color: var(--gym-primary) !important;
}

/* --- Content width on large screens --- */
@media (min-width: 1200px) {
    main .container {
        max-width: 1080px;
    }
}

/* ============================================================
   Member dashboard
   ============================================================ */
.dash-greeting {
    padding: 20px 0 4px;
}

.dash-greeting h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.dash-greeting .dash-date {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    .dash-greeting h1 { font-size: 2rem; }
}

.next-workout-card {
    border: 1px solid rgba(255, 107, 53, 0.35);
    border-left: 4px solid var(--gym-primary);
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.10), rgba(247, 147, 30, 0.05));
    border-radius: 12px;
}

.dash-card {
    background: rgba(var(--bs-body-bg-rgb), 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.stat-chip {
    background: rgba(var(--bs-body-bg-rgb), 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
}

.stat-chip .stat-num {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gym-primary);
    line-height: 1.1;
}

.stat-chip .stat-label {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: 12px;
    background: rgba(var(--bs-body-bg-rgb), 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
    font-size: 0.8rem;
    text-align: center;
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.quick-action i {
    font-size: 1.35rem;
    color: var(--gym-primary);
}

.quick-action:hover {
    border-color: var(--gym-primary);
    color: #fff;
    transform: translateY(-2px);
}

.dash-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dash-list-item:last-child { border-bottom: none; }

.dash-list-item .dl-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 107, 53, 0.12);
    color: var(--gym-primary);
    flex-shrink: 0;
}

.dash-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

/* ============================================================
   Uniform page header — slim title block for all member pages.
   Replaces the old giant hero-image banners.
   ============================================================ */
.page-header {
    padding: 20px 0 4px;
    margin-bottom: 16px;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--gym-primary);
}

.page-header h1 i {
    margin-right: 8px;
}

.page-header .page-subtitle {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.9rem;
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .page-header h1 { font-size: 2rem; }
}

/* ============================================================
   Visitor top bar — slim fixed header for logged-out mobile.
   Same safe-area-aware chrome as .app-topbar so the brand and
   buttons never slide under the iPhone notch/status bar.
   ============================================================ */
.visitor-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top);
    background: rgba(var(--bs-dark-rgb), 0.97);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1030;
}

.visitor-topbar .brand-logo {
    height: 56px;
}

.visitor-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.visitor-btn {
    padding: 6px 16px;
    font-weight: 600;
    border-radius: 20px;
}

/* Logged-out pages get pushed below the fixed visitor top bar */
@media (max-width: 767.98px) {
    body:not(.app-shell) {
        padding-top: calc(var(--topbar-h) + env(safe-area-inset-top));
    }
}

/* ============================================================
   Landing page (logged-out visitors)
   ============================================================ */
.landing-hero {
    position: relative;
    overflow: hidden;
    padding: 48px 0 40px;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255, 107, 53, 0.22), transparent 70%),
        var(--hero-bg);
}

@media (min-width: 768px) {
    .landing-hero { padding: 88px 0 72px; }
}

.landing-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
    z-index: 0;
}

.landing-hero .container {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 107, 53, 0.45);
    background: rgba(255, 107, 53, 0.10);
    color: var(--gym-primary);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.hero-title {
    font-size: clamp(2.1rem, 7vw, 3.6rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.5px;
}

.text-grad {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.hero-lead {
    color: rgba(255, 255, 255, 0.72);
    font-size: 1.05rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 768px) {
    .hero-lead { font-size: 1.2rem; }
}

.hero-ctas .btn {
    border-radius: 12px;
    font-weight: 600;
}

.hero-facts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 28px;
    margin-top: 28px;
    padding: 0;
    list-style: none;
}

.hero-facts li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
}

.hero-facts i {
    color: var(--gym-primary);
}

/* How-it-works steps */
.step-card {
    background: rgba(var(--bs-body-bg-rgb), 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    height: 100%;
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.step-card:hover {
    border-color: rgba(255, 107, 53, 0.5);
    transform: translateY(-2px);
}

.step-num {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    color: #fff;
    font-weight: 700;
    margin-bottom: 10px;
}

/* CTA band */
.cta-section {
    background: var(--primary-gradient);
}

.cta-section h3,
.cta-section .lead {
    color: #fff;
}

.cta-section .lead {
    opacity: 0.92;
}

/* ============================================================
   Exercise detail page
   ============================================================ */
.exercise-media {
    border: 1px solid rgba(255, 107, 53, 0.35);
    border-left: 4px solid var(--gym-primary);
    background: rgba(var(--bs-body-bg-rgb), 0.75);
    overflow: hidden;
}

.exercise-media .media-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    min-height: 260px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.exercise-media .media-stage.tappable {
    cursor: pointer;
}

.exercise-media .media-stage img,
.exercise-media .media-stage video {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    border-radius: 8px;
}

@media (min-width: 768px) {
    .exercise-media .media-stage { min-height: 380px; }
    .exercise-media .media-stage img,
    .exercise-media .media-stage video { max-height: 460px; }
}

.media-flip-hint {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    color: var(--gym-primary);
    border: 1px solid rgba(255, 107, 53, 0.5);
    padding: 0.5em 0.9em;
    font-size: 0.85rem;
    white-space: nowrap;
}

.media-credit {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
}

/* "How to do it" step list */
.howto-steps {
    list-style: none;
    counter-reset: howto;
    margin: 0;
    padding: 0;
}

.howto-steps li {
    counter-increment: howto;
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    line-height: 1.55;
}

.howto-steps li:last-child {
    border-bottom: none;
}

.howto-steps li::before {
    content: counter(howto);
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 107, 53, 0.15);
    border: 1px solid rgba(255, 107, 53, 0.5);
    color: var(--gym-primary);
    font-weight: 700;
    font-size: 0.85rem;
}

/* "Be careful" box */
.be-careful {
    border: 1px solid rgba(255, 193, 7, 0.4);
    border-left: 4px solid #ffc107;
    background: rgba(255, 193, 7, 0.07);
    border-radius: 12px;
}

.be-careful ul {
    margin: 0;
    padding-left: 1.1rem;
}

.be-careful li {
    padding: 6px 0;
    line-height: 1.55;
}

/* Full-width tap-friendly CTA under the exercise header */
.add-to-workout .btn {
    border-radius: 12px;
    font-weight: 700;
}

/* ==========================================================================
   Modal screen fit — every modal stays inside the visible screen, including
   the iPhone status-bar/notch area (safe-area-inset-top) and the home
   indicator (safe-area-inset-bottom). Fixes the exercise-search modal opening
   with its header hidden behind the phone status bar.
   ========================================================================== */
.modal-dialog {
    margin-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    margin-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    max-height: calc(100vh - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

.modal-content {
    max-height: inherit;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Red unread-posts badge on the Community nav entries
   ========================================================================== */
.nav-unread-badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 4px;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    vertical-align: 2px;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

/* Bottom tab bar: pin the badge to the top corner of the Community tab */
.app-tab {
    position: relative;
}

.nav-unread-badge.tab {
    position: absolute;
    top: 4px;
    left: calc(50% + 2px);
    margin-left: 0;
}

/* ==========================================================================
   Member analytics page (admin) — dark theme, orange accents
   ========================================================================== */
.analytics-page .card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 107, 53, 0.25);
    border-radius: 14px;
}

.ana-hero {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.14), rgba(255, 255, 255, 0.03)) !important;
}

.ana-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 107, 53, 0.2);
    border: 2px solid #ff6b35;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #ff6b35;
    flex-shrink: 0;
}

.ana-streak {
    text-align: center;
    background: linear-gradient(135deg, #ff6b35, #e8531c);
    border-radius: 14px;
    padding: 12px 22px;
    color: #fff;
    flex-shrink: 0;
}

.ana-streak-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.ana-streak-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.ana-stat {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ana-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255, 107, 53, 0.15);
}

.ana-stat-icon {
    font-size: 1.4rem;
    display: block;
    margin-bottom: 6px;
}

.ana-stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}

.ana-stat-label {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.8rem;
}

.ana-card-title {
    font-weight: 700;
    margin-bottom: 1rem;
}

.ana-scroll {
    max-height: 260px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ana-timeline-item {
    position: relative;
    padding-left: 1.4rem;
    margin-bottom: 0.75rem;
}

.ana-timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.35rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff6b35;
}

.ana-list-item {
    border-left: 3px solid rgba(255, 255, 255, 0.15);
    padding: 6px 0 6px 0.8rem;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}

.ana-list-item.success { border-left-color: #2ecc71; }
.ana-list-item.primary { border-left-color: #ff6b35; }
.ana-list-item.info    { border-left-color: #3498db; }
.ana-list-item.warning { border-left-color: #f0ad4e; }

.ana-mini-stat {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 10px 4px;
}

.ana-mini-number {
    font-size: 1.3rem;
    font-weight: 700;
}

.ana-mini-label {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.ana-big-badge {
    display: inline-block;
    font-size: 1.4rem;
    font-weight: 800;
    background: rgba(240, 173, 78, 0.15);
    border: 1px solid rgba(240, 173, 78, 0.5);
    color: #f0ad4e;
    border-radius: 10px;
    padding: 4px 18px;
}

.ana-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.4);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 0.85rem;
}

.ana-chip-count {
    background: #ff6b35;
    color: #fff;
    border-radius: 999px;
    padding: 0 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.ana-sched {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 10px;
    padding: 12px 14px;
    height: 100%;
}

/* ==========================================================================
   Community upgrades: pinned posts, photo posts, emoji reactions,
   reply-to-comment threading
   ========================================================================== */
.pinned-post {
    border: 1px solid rgba(255, 107, 53, 0.55) !important;
    background: linear-gradient(180deg, rgba(255, 107, 53, 0.07), transparent 40%);
}

.pinned-label {
    display: inline-flex;
    align-items: center;
    color: #ff6b35;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.post-image img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(255, 107, 53, 0.25);
}

/* Emoji reaction buttons */
.reaction-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.95rem;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
    color: inherit;
}

.reaction-btn:hover {
    border-color: rgba(255, 107, 53, 0.6);
    background: rgba(255, 107, 53, 0.12);
    transform: translateY(-1px);
}

.reaction-btn.active {
    border-color: #ff6b35;
    background: rgba(255, 107, 53, 0.22);
    box-shadow: 0 0 0 1px rgba(255, 107, 53, 0.35);
}

.reaction-count {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.75);
}

/* Comment replies */
.comment-reply {
    margin-left: 2.4rem;
}

.reply-btn {
    background: none;
    border: none;
    color: rgba(255, 107, 53, 0.85);
    font-size: 0.78rem;
    padding: 0 0 0 4px;
    cursor: pointer;
}

.reply-btn:hover {
    color: #ff6b35;
    text-decoration: underline;
}

.reply-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 107, 53, 0.12);
    border: 1px solid rgba(255, 107, 53, 0.4);
    border-radius: 8px;
    padding: 4px 10px;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
}

.reply-cancel {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.reply-cancel:hover {
    color: #fff;
}

/* ==================== Guest chat (visitor landing page) ==================== */
.guest-chat-bubble {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 1045;
    background: var(--gym-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 6px 24px rgba(255, 107, 53, 0.45);
    cursor: pointer;
}
.guest-chat-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(255, 107, 53, 0.6);
}

.guest-chat-panel {
    position: fixed;
    right: 16px;  /* aligned with the bubble's right offset */
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 1046;
    width: min(360px, calc(100vw - 32px));
    max-height: min(520px, calc(100vh - 100px));
    display: flex;
    flex-direction: column;
    background: #14161f;
    border: 1px solid rgba(255, 107, 53, 0.4);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    /* fixed forever — never transformed, dragged or repositioned after open */
    transform: none;
}

/* while the panel is open on small screens, the page behind must not scroll.
   Class goes on <html>; the body is pulled out of flow (position: fixed with
   a negative top offset set from JS to preserve scroll position) because
   overflow:hidden alone does NOT stop touch-gesture scrolling on mobile. */
html.guest-chat-lock,
html.guest-chat-lock body {
    overflow: hidden;
    overscroll-behavior: none;
}
html.guest-chat-lock body {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
}

.guest-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 107, 53, 0.15);
    border-bottom: 1px solid rgba(255, 107, 53, 0.3);
}

.guest-chat-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
}
.guest-chat-close:hover { color: #fff; }

.guest-chat-messages {
    flex: 1;
    min-height: 200px;
    min-width: 0;  /* flex child may shrink below content width */
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;  /* never chain scroll into the page behind */
    -webkit-overflow-scrolling: touch;
    padding: 12px;
}

.guest-chat-msg {
    padding: 9px 13px;
    border-radius: 12px;
    margin-bottom: 9px;
    max-width: 88%;
    min-width: 0;
    line-height: 1.45;
    font-size: 0.9rem;
    color: #fff;
    white-space: pre-wrap;
    overflow-wrap: anywhere;  /* long URLs / unbroken strings wrap, never leak */
    word-break: break-word;
}
.guest-chat-msg a {
    color: #ffb08a;
    text-decoration: underline;
    overflow-wrap: anywhere;
}
.guest-chat-msg a:hover { color: #ffc9ad; }
.guest-chat-bot {
    background: rgba(255, 107, 53, 0.15);
    border: 1px solid rgba(255, 107, 53, 0.4);
}
.guest-chat-user {
    background: rgba(255, 255, 255, 0.08);
    margin-left: auto;
    text-align: right;
}
.guest-chat-thinking { opacity: 0.6; font-style: italic; }

.guest-chat-inputrow {
    display: flex;
    gap: 8px;
    padding: 10px 12px 4px;
}
.guest-chat-inputrow input {
    flex: 1;
    min-width: 0;  /* let the input shrink instead of pushing the row wide */
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 107, 53, 0.5);
    border-radius: 10px;
    color: #fff;
    padding: 8px 12px;
    font-size: 0.9rem;
    outline: none;
}
.guest-chat-inputrow input:focus { border-color: var(--gym-primary); }
.guest-chat-inputrow button {
    background: var(--gym-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    min-width: 44px;
    cursor: pointer;
}
.guest-chat-inputrow button:disabled { opacity: 0.5; cursor: wait; }

.guest-chat-note {
    margin: 0;
    padding: 6px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
}

/* Small screens: the open panel becomes a stable bottom sheet — near
   full-width, anchored to the bottom, input row always visible, page
   behind scroll-locked (body.guest-chat-lock, toggled from JS). */
@media (max-width: 640px) {
    .guest-chat-panel {
        left: 8px;
        right: 8px;
        width: auto;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        max-height: 78vh;
        max-height: 78dvh;
        border-radius: 16px 16px 12px 12px;
    }
    .guest-chat-messages {
        min-height: 160px;
    }
}

/* ==================== Unified button system ====================
   One coherent look for every Bootstrap button in the app (dark theme).
   Same action = same style everywhere:
     btn-primary          = main action (orange gradient)
     btn-secondary        = neutral filled (Cancel / Close / secondary nav)
     btn-outline-primary  = secondary action tied to the theme (schedule, reply)
     btn-outline-secondary= quiet nav (back links, filters)
     btn-outline-light    = ghost on dark/hero surfaces
     btn-danger / outline-danger = destructive
     btn-success / warning / light = semantic accents
*/
.btn {
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background-color .15s ease, border-color .15s ease,
                color .15s ease, box-shadow .15s ease,
                transform .15s ease, filter .15s ease;
}
.btn-lg { border-radius: 12px; font-weight: 700; }
.btn-sm { border-radius: 8px; }

/* subtle lift on hover, press on click (not for text links / overlays) */
@media (hover: hover) {
    /* calendar nav buttons keep their own hover lift — don't override it */
    .btn:not(:disabled):not(.disabled):not(.btn-link):not(.undo-btn):not(.btn-navigation-arrow):not(.btn-navigation-today):hover {
        transform: translateY(-1px);
    }
}
.btn:not(:disabled):not(.btn-link):active {
    transform: translateY(0);
}

/* Disabled: muted dark-theme look with readable contrast (not stock
   Bootstrap grey/blue) — same for every variant */
.btn:disabled, .btn.disabled {
    opacity: 1;
    box-shadow: none;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.55);
}

/* ---- primary: the one true call-to-action ---- */
.btn-primary {
    background: linear-gradient(135deg, var(--gym-primary) 0%, var(--gym-secondary) 100%);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(255, 107, 53, 0.35);
}
.btn-primary:hover,
.btn-primary:focus-visible {
    background: linear-gradient(135deg, #ff8152 0%, #ffa53a 100%);
    border: none;
    color: #fff;
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}
.btn-primary:active {
    background: linear-gradient(135deg, #e85a28 0%, #e08414 100%);
    border: none;
    color: #fff;
}

/* ---- neutral filled (Cancel / Close) ---- */
.btn-secondary {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.88);
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
    background: rgba(255, 255, 255, 0.17);
    border-color: rgba(255, 255, 255, 0.30);
    color: #fff;
}

/* ---- quiet outline (back links, filters, secondary nav) ---- */
.btn-outline-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: rgba(255, 255, 255, 0.85);
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
}

/* ---- theme outline (secondary actions: schedule, reply, options) ---- */
.btn-outline-primary {
    background: transparent;
    border: 1px solid rgba(255, 107, 53, 0.6);
    color: var(--gym-primary);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
    background: rgba(255, 107, 53, 0.14);
    border-color: var(--gym-primary);
    color: #ffb08a;
}
.btn-outline-primary:active {
    background: rgba(255, 107, 53, 0.22);
    border-color: var(--gym-primary);
    color: #fff;
}

/* ---- ghost on dark / hero surfaces ---- */
.btn-outline-light {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
}
.btn-outline-light:hover,
.btn-outline-light:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.7);
    color: #fff;
}

/* ---- destructive ---- */
.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(231, 76, 60, 0.30);
}
.btn-danger:hover,
.btn-danger:focus-visible {
    background: linear-gradient(135deg, #f05545 0%, #d04433 100%);
    border: none;
    color: #fff;
    box-shadow: 0 6px 18px rgba(231, 76, 60, 0.45);
}
.btn-outline-danger {
    background: transparent;
    border: 1px solid rgba(231, 76, 60, 0.55);
    color: #ff8a7a;
}
.btn-outline-danger:hover,
.btn-outline-danger:focus-visible {
    background: rgba(231, 76, 60, 0.15);
    border-color: #e74c3c;
    color: #ff9d8f;
}

/* ---- semantic accents ---- */
.btn-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(46, 204, 113, 0.28);
}
.btn-success:hover,
.btn-success:focus-visible {
    background: linear-gradient(135deg, #40d97f 0%, #2ec06c 100%);
    border: none;
    color: #fff;
}
.btn-outline-success {
    background: transparent;
    border: 1px solid rgba(46, 204, 113, 0.55);
    color: #5fe39a;
}
.btn-outline-success:hover,
.btn-outline-success:focus-visible {
    background: rgba(46, 204, 113, 0.14);
    border-color: #2ecc71;
    color: #7debab;
}
.btn-warning {
    background: linear-gradient(135deg, #f5b041 0%, #f39c12 100%);
    border: none;
    color: #1a1a1a;
}
.btn-warning:hover,
.btn-warning:focus-visible {
    background: linear-gradient(135deg, #f7bc55 0%, #f5a623 100%);
    border: none;
    color: #1a1a1a;
}
.btn-outline-warning {
    background: transparent;
    border: 1px solid rgba(243, 156, 18, 0.55);
    color: #f5b041;
}
.btn-outline-warning:hover,
.btn-outline-warning:focus-visible {
    background: rgba(243, 156, 18, 0.14);
    border-color: #f39c12;
    color: #f7bc55;
}
.btn-outline-info {
    background: transparent;
    border: 1px solid rgba(23, 162, 184, 0.55);
    color: #5bc8dc;
}
.btn-outline-info:hover,
.btn-outline-info:focus-visible {
    background: rgba(23, 162, 184, 0.14);
    border-color: #17a2b8;
    color: #7fd6e6;
}
.btn-light {
    background: rgba(255, 255, 255, 0.92);
    border: none;
    color: #1a1a1a;
}
.btn-light:hover,
.btn-light:focus-visible {
    background: #ffffff;
    border: none;
    color: #1a1a1a;
}
.btn-link {
    color: var(--gym-primary);
}

/* Keyboard focus ring — declared after every variant so no variant focus
   style can override it. :focus-visible only, so it never fires on mouse
   click and never leaves a persistent halo. */
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.45);
}

/* touch-friendly targets on phones (every .btn reaches 44px) */
@media (max-width: 767.98px) {
    .btn { padding-top: 0.55rem; padding-bottom: 0.55rem; min-height: 44px; }
    .btn-lg { padding-top: 0.8rem; padding-bottom: 0.8rem; }
}

/* undo overlay on completed exercise cards (was inline-styled) */
.undo-btn {
    position: absolute;
    top: 70%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--gym-primary) 0%, var(--gym-secondary) 100%);
    color: #fff;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    transition: box-shadow .15s ease, filter .15s ease;
}

/* ==========================================================================
   PWA install banner — on-theme (was Bootstrap alert-info cyan) and placed
   below the safe-area-aware top bar instead of a hardcoded 70px.
   ========================================================================== */
.install-banner {
    position: fixed;
    top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 8px);
    right: 16px;
    z-index: 1050;
    max-width: 300px;
    background: rgba(var(--bs-dark-rgb), 0.98);
    border: 1px solid rgba(255, 107, 53, 0.45);
    border-left: 4px solid var(--gym-primary);
    border-radius: 12px;
    padding: 12px 14px;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.install-banner i.fa-mobile-alt {
    color: var(--gym-primary);
}

/* ==========================================================================
   Touch targets on phones: the per-set done tick and copy-arrow on the
   trainer page must reach 44x44px (new_smart_trainer.html pins them smaller
   in its own stylesheet, hence !important here). Desktop sizes unchanged.
   ========================================================================== */
@media (max-width: 767.98px) {
    .set-done-btn,
    .copy-to-next-btn {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    .copy-to-next-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
.undo-btn:hover { filter: brightness(1.1); }
