body {
    box-sizing: border-box;
}

:root {
    --primary-black: #0a0a0a;
    --charcoal: #141414;
    --dark-gray: #1a1a1a;
    --neon-orange: #ff6b00;
    --dark-orange: #cc5500;
    --glow-orange: rgba(255, 107, 0, 0.4);
}

/* Lightning Background */
.lightning-bg {
    position: relative;
    overflow: hidden;
    background-image: url('./lightning-mobile.png');
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
}

/* Desktop version */
@media (min-width: 768px) {
    .lightning-bg {
        background-image: url('./lightning-desktop.png');
        background-position: center;
    }
}

/* ===== BLUR OVERLAY ===== */
.lightning-blur::before {
    content: "";
    position: absolute;
    inset: 0;
    backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, 0.55);
    z-index: 0;
}

.lightning-blur>* {
    position: relative;
    z-index: 1;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--neon-orange) var(--charcoal);
}

.font-bebas {
    font-family: 'Bebas Neue', sans-serif;
}

.font-inter {
    font-family: 'Inter', sans-serif;
}

.glow-effect {
    box-shadow: 0 0 30px var(--glow-orange), 0 0 60px rgba(255, 107, 0, 0.2);
}

.glow-text {
    text-shadow: 0 0 20px var(--glow-orange), 0 0 40px rgba(255, 107, 0, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-orange), var(--dark-orange));
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Lightning Shine Effect for Buttons */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-20deg);
    transition: all 0.7s ease;
}

.btn-primary:hover {
    box-shadow: 0 0 25px var(--glow-orange), 0 0 50px rgba(255, 107, 0, 0.3);
    transform: translateY(-2px);
}

.btn-primary:hover::before {
    left: 200%;
}

.card-dark {
    background: linear-gradient(145deg, var(--charcoal), var(--dark-gray));
    border: 1px solid rgba(255, 107, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-dark:hover {
    border-color: rgba(255, 107, 0, 0.3);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 107, 0, 0.2);
}

/* Only apply lift effect in main site, not dashboards */
body:not(.dashboard-page) .card-dark:hover {
    transform: translateY(-8px);
}

.input-dark {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 107, 0, 0.2);
    transition: all 0.3s ease;
}

.input-dark:focus {
    border-color: var(--neon-orange);
    box-shadow: 0 0 15px rgba(255, 107, 0, 0.2);
    outline: none;
}

.input-dark:read-only {
    background: rgba(20, 20, 20, 0.5);
    opacity: 0.7;
    cursor: not-allowed;
}

/* ==========================================
   CUSTOM SELECT DROPDOWN STYLING (VOLTA THEME)
   ========================================== */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Custom Orange Volta Arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6b00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    background-size: 1.2em;
    cursor: pointer;
    padding-right: 2.8rem !important;
}

/* Style the options list to match dark theme */
select option {
    background-color: #1a1a1a;
    color: #ffffff;
    font-size: 15px;
    padding: 12px;
    font-family: 'Inter', sans-serif;
}

/* Hack to style the hover/selected state of options in Chrome/Edge */
select option:checked,
select option:hover,
select option:focus {
    background-color: var(--neon-orange) !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px 100px var(--neon-orange) inset !important;
}

.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--neon-orange);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px var(--glow-orange);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 40px var(--glow-orange), 0 0 60px rgba(255, 107, 0, 0.3);
        transform: scale(1.05);
    }
}

.pulse-glow {
    animation: pulse-glow 2s infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

.page {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.page.active {
    display: block;
    opacity: 1;
}

.social-panel {
    transform: translateX(100%);
    transition: transform 0.4s ease, visibility 0.4s ease;
    visibility: hidden;
}

.social-panel.open {
    transform: translateX(0);
    visibility: visible;
}

.overlay {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.open {
    opacity: 1;
    visibility: visible;
}

.stat-card {
    background: linear-gradient(145deg, rgba(255, 107, 0, 0.1), rgba(20, 20, 20, 0.9));
    border: 1px solid rgba(255, 107, 0, 0.2);
}

/* Custom Animation System */
.volta-animate {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.volta-animate-text {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.is-visible {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
}

/* Mobile Menu Animation */
.mobile-menu-container {
    max-height: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-15px) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.mobile-menu-container.open {
    max-height: 500px !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Signup Multi-Step Form */
.signup-step {
    display: none;
}

.signup-step.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

.signup-step.hidden-left {
    display: block;
    animation: fadeOutLeft 0.4s ease-in-out forwards;
}

.signup-step.hidden-right {
    display: block;
    animation: fadeOutRight 0.4s ease-in-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutLeft {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(20px);
        display: none;
    }
}

@keyframes fadeOutRight {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(20px);
        display: none;
    }
}

.step-indicator {
    width: 40px;
    height: 8px;
    border-radius: 99px;
    background-color: #333;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-indicator.active {
    background-color: var(--neon-orange);
    width: 60px;
}

/* ==========================================
   MOBILE & VIEWPORT STYLING OPTIMIZATIONS (iPhone & Android)
   ========================================== */
html {
    -webkit-text-size-adjust: 100%; /* Prevent iOS text size adjust */
    scroll-behavior: smooth;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    max-width: 100%;
    overflow-x: hidden;
    /* Safe Area Insets for Notch iPhones & Modern Androids */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* Prevent auto-zooming on focus in iOS Safari for all inputs */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Optimize scroll experience on touch screens */
.overflow-y-auto, .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}

/* Adjust paddings/margins on small devices (e.g. iPhone SE / 320px width) */
@media screen and (max-width: 375px) {
    .card-dark {
        padding: 1rem !important; /* Make card padding slightly tighter */
    }
    
    h1, .font-bebas {
        word-break: break-word; /* Avoid breaking layouts for long titles */
    }

    /* Keep grid layouts clean on extra small screens */
    .grid-cols-2 {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    }
}

/* Enhance styling for dashboard sections on mobile screen */
@media screen and (max-width: 640px) {
    .stat-card {
        padding: 1rem !important;
    }
    
    .stat-card p.text-3xl {
        font-size: 1.5rem !important; /* Tighter typography for cards on mobile */
    }
}

/* ==========================================
   MOBILE HUB & OVERLAYS STYLING
   ========================================== */
@media (max-width: 767px) {
    /* Hide desktop dashboard sections unless active as overlay */
    #dashboard-workout-section:not(.mobile-active-overlay),
    #dashboard-plan-container:not(.mobile-active-overlay),
    #dashboard-weekly-update-section:not(.mobile-active-overlay) {
        display: none !important;
    }

    /* Always hide calculators on mobile - they don't fit on small screens */
    #dashboard-calculators-section {
        display: none !important;
    }

    /* Mobile full-screen overlay styles */
    .mobile-active-overlay {
        display: block !important;
        position: relative !important;
        z-index: 10 !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 16px 0 24px 0 !important;
        border: none !important;
        box-shadow: none !important;
    }
}

/* Premium gradient and glassmorphism styling for mobile hub cards */
.hub-card {
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.7), rgba(10, 10, 10, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}
.hub-card:active {
    transform: scale(0.97);
    border-color: rgba(255, 255, 255, 0.2);
}