/* Native Mobile CSS - App Store Experience */
/* Version: 1.1 - Enhanced Sprint with Premium Polish */

:root {
    /* Mobile-specific spacing */
    --mobile-nav-height: 64px;
    --mobile-bottom-nav-height: 60px;
    --mobile-safe-area-top: env(safe-area-inset-top, 0px);
    --mobile-safe-area-bottom: env(safe-area-inset-bottom, 0px);

    /* Touch target sizes (Apple HIG: 44px min) */
    --touch-target-min: 44px;
    --touch-target-comfortable: 48px;
}

/* PWA Standalone Mode Adjustments */
@media (display-mode: standalone) {
    body {
        padding-top: var(--mobile-safe-area-top);
        padding-bottom: var(--mobile-safe-area-bottom);
    }

    /* Hide browser-specific UI when in standalone */
    .browser-only {
        display: none !important;
    }
}

/* Mobile-First Base Styles */
@media (max-width: 768px) {

    /* Prevent overscroll bounce on iOS */
    html,
    body {
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
    }

    /* Native-feeling scrolling containers */
    .native-scroll {
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: y proximity;
    }

    /* Bottom navigation spacing */
    body.has-bottom-nav {
        padding-bottom: calc(var(--mobile-bottom-nav-height) + var(--mobile-safe-area-bottom));
    }

    /* Touch-friendly form elements */
    input,
    select,
    textarea,
    button {
        min-height: var(--touch-target-min);
        font-size: 16px !important;
        /* Prevent iOS zoom */
    }

    /* Cards with native shadows */
    .mobile-card {
        background: var(--card-bg, #1a1a24);
        border-radius: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        overflow: hidden;
    }

    /* iOS-style section headers */
    .mobile-section-header {
        font-size: 13px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-muted, #888);
        padding: 8px 16px;
        margin-top: 24px;
    }

    /* Pull-to-refresh indicator placeholder */
    .pull-indicator {
        height: 0;
        overflow: hidden;
        transition: height 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .pull-indicator.active {
        height: 50px;
    }
}

/* Bottom Navigation Bar */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-bottom-nav-height);
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(200, 200, 240, 0.14);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    padding-bottom: var(--mobile-safe-area-bottom);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.mobile-bottom-nav.visible {
    transform: translateY(0);
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--text-muted, #888);
    text-decoration: none;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav .nav-item.active {
    color: var(--nb-gold, #d4af37);
}

.mobile-bottom-nav .nav-item i {
    font-size: 22px;
    margin-bottom: 2px;
}

.mobile-bottom-nav .nav-item span {
    font-size: 10px;
    font-weight: 500;
}

/* Haptic feedback simulation */
.mobile-bottom-nav .nav-item:active {
    transform: scale(0.92);
}

/* Hide desktop/top navigation on mobile when bottom nav is present */
@media (max-width: 768px) {

    body.has-bottom-nav .desktop-nav-only,
    body.has-bottom-nav .site-header,
    body.has-bottom-nav nav.site-header,
    body.has-bottom-nav .video-nav,
    body.has-bottom-nav nav.video-nav,
    body.has-bottom-nav .global-nav,
    body.has-bottom-nav header.site-header {
        display: none !important;
    }
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: calc(var(--mobile-bottom-nav-height) + 16px + var(--mobile-safe-area-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--nb-gold, #d4af37);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
    z-index: 999;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.fab i {
    font-size: 24px;
}

/* Native-style list items */
.native-list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg, #1a1a24);
    border-bottom: 1px solid rgba(200, 200, 240, 0.14);
    min-height: var(--touch-target-comfortable);
    -webkit-tap-highlight-color: transparent;
}

.native-list-item:active {
    background: rgba(200, 200, 240, 0.08);
}

.native-list-item:last-child {
    border-bottom: none;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #28283a 25%, #3a3a3a 50%, #28283a 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Toast notifications - native style */
.native-toast {
    position: fixed;
    bottom: calc(var(--mobile-bottom-nav-height) + 20px + var(--mobile-safe-area-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(50, 50, 50, 0.95);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.native-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Swipe actions container */
.swipe-container {
    position: relative;
    overflow: hidden;
}

.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    display: flex;
    transform: translateX(100%);
    transition: transform 0.2s ease;
}

.swipe-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    color: #fff;
    font-weight: 600;
}

.swipe-action.delete {
    background: #ff3b30;
}

.swipe-action.edit {
    background: #007aff;
}

/* ============================================
   NATIVE MOBILE DASHBOARD - Sprint 1.5
   Clean, iOS-inspired design patterns
   ============================================ */

@media (max-width: 768px) {

    /* ========== DASHBOARD SHELL ========== */
    .dashboard-shell {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: 1rem !important;
    }

    .dashboard-shell>section,
    .dashboard-shell>.dashboard-section {
        margin-left: 0;
        margin-right: 0;
        border-radius: 0 !important;
    }

    /* ========== HERO SECTION ========== */
    .dashboard-hero {
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 1.25rem 1rem !important;
    }

    .dashboard-hero__title {
        font-size: 1.75rem !important;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .hero-cta .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
        border-radius: 14px;
    }

    .hero-chip {
        padding: 10px 16px;
        font-size: 0.85rem;
        border-radius: 12px;
    }

    .hero-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .hero-stat {
        padding: 0.75rem;
        border-radius: 12px;
        border: none !important;
        background: rgba(200, 200, 240, 0.08) !important;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    /* ========== CARDS - iOS STYLE ========== */
    .card-modern,
    .dashboard-section {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        margin-top: 0.5rem !important;
        padding: 1rem !important;
    }

    .card-modern-header {
        padding: 0 0 0.75rem 0 !important;
        border-bottom: 1px solid rgba(200, 200, 240, 0.15);
        margin-bottom: 1rem;
    }

    .card-modern-body {
        padding: 0 !important;
    }

    /* ========== MY CLASSES - CLEAN CARDS ========== */
    #sectionClasses {
        padding: 0 !important;
    }

    #sectionClasses .p-6 {
        padding: 0 !important;
    }

    #sectionClasses h3 {
        font-size: 1.25rem;
        padding: 0.75rem 1rem;
        margin: 0;
        background: rgba(200, 200, 240, 0.05);
        border-bottom: 1px solid rgba(200, 200, 240, 0.15);
    }

    /* Class cards - compact, no internal borders */
    #sectionClasses .row.g-3 {
        margin: 0 !important;
        gap: 0 !important;
    }

    #sectionClasses .col-md-6,
    #sectionClasses .col-lg-4 {
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    /* Individual class card */
    #sectionClasses .col-md-6>div,
    #sectionClasses .col-lg-4>div {
        border-radius: 0 !important;
        border: none !important;
        border-bottom: 1px solid rgba(200, 200, 240, 0.09) !important;
        padding: 1rem !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    #sectionClasses .col-md-6>div:last-child,
    #sectionClasses .col-lg-4>div:last-child {
        border-bottom: none !important;
    }

    /* Class name styling for mobile */
    #sectionClasses h5.text-center.mb-3 {
        text-align: left !important;
        font-size: 1rem;
    }

    #sectionClasses h5 {
        font-size: 1rem;
        margin-bottom: 0.5rem !important;
        text-align: left !important;
    }

    /* Compact date/time display */
    #sectionClasses .row.g-2.text-center {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        text-align: left !important;
    }

    #sectionClasses .row.g-2 .col-12 {
        width: auto !important;
        flex: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Keep date/time labels visible but compact */
    #sectionClasses .row.g-2 .col-12>div:first-child {
        display: inline !important;
        font-size: 0.75rem;
        color: var(--nb-muted, #888);
    }

    #sectionClasses .row.g-2 .fw-bold {
        font-size: 0.85rem;
        font-weight: 500 !important;
        color: var(--nb-muted, #999);
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
    }

    #sectionClasses .row.g-2 .fw-bold::before {
        font-family: "bootstrap-icons";
        font-size: 0.8rem;
        opacity: 0.7;
    }

    /* Action buttons row - STACK VERTICALLY */
    #sectionClasses .mt-3.pt-2 {
        margin-top: 0.75rem !important;
        padding-top: 0.75rem !important;
        border-top: 1px solid rgba(200, 200, 240, 0.08);
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    #sectionClasses .btn-sm {
        width: 100% !important;
        padding: 12px 16px;
        font-size: 0.9rem;
        border-radius: 12px;
        min-height: 44px;
        text-align: center;
    }

    /* Ensure forms inside don't break layout */
    #sectionClasses form {
        width: 100% !important;
        margin: 0 !important;
    }

    /* ========== PROFILE SECTION ========== */
    #sectionProfile {
        border-radius: 0 !important;
    }

    #sectionProfile .row.g-4 {
        gap: 0 !important;
    }

    #sectionProfile .col-md-4 {
        padding: 0.75rem 0 !important;
        border-bottom: 1px solid rgba(200, 200, 240, 0.09);
    }

    #sectionProfile .col-md-4:last-child {
        border-bottom: none;
    }

    /* ========== BUTTONS - TOUCH FRIENDLY ========== */
    .btn {
        min-height: 44px;
        border-radius: 12px;
        -webkit-tap-highlight-color: transparent;
    }

    .btn:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }

    /* ========== FORM ELEMENTS ========== */
    .form-control-modern,
    .form-control {
        border-radius: 12px;
        padding: 14px 16px;
        min-height: 48px;
    }

    /* ========== GENERAL POLISH ========== */

    /* Reduce excessive margins */
    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mb-3 {
        margin-bottom: 0.75rem !important;
    }

    .mt-3 {
        margin-top: 0.75rem !important;
    }

    /* Hide decorative elements */
    .eyebrow {
        font-size: 0.7rem;
        letter-spacing: 0.1em;
    }

    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }

    /* Prevent text selection on interactive elements */
    .nav-item,
    .btn,
    .mobile-bottom-nav {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* ============================================
   ENHANCED MOBILE OPTIMIZATIONS
   Phase 3: Premium Polish - iOS/Android Native Feel
   ============================================ */

/* Swipe Hint Indicators */
.swipe-hint-left::before,
.swipe-hint-right::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 10;
}

.swipe-hint-left::before {
    left: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.15), transparent);
}

.swipe-hint-right::after {
    right: 0;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.15), transparent);
}

/* Enhanced Touch Targets */
@media (max-width: 768px) {
    .touch-target-enhanced {
        position: relative;
        min-height: 48px;
        min-width: 48px;
    }

    .touch-target-enhanced::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: max(100%, 48px);
        height: max(100%, 48px);
    }
}

/* iOS-style Haptic Visual Feedback */
.haptic-feedback:active {
    animation: haptic-pulse 0.15s ease-out;
}

@keyframes haptic-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
    }
}

/* Android-style Ripple Container */
@media (max-width: 768px) {
    .ripple-touch {
        position: relative;
        overflow: hidden;
    }

    .ripple-touch::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: rgba(212, 175, 55, 0.2);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: width 0.4s, height 0.4s, opacity 0.4s;
        opacity: 0;
    }

    .ripple-touch:active::after {
        width: 200%;
        height: 200%;
        opacity: 1;
        transition: 0s;
    }
}

/* Pull-to-Refresh Enhanced */
.ptr-container {
    position: relative;
    overflow: hidden;
}

.ptr-indicator {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    opacity: 0;
    transition: top 0.3s, opacity 0.3s;
}

.ptr-indicator.pulling {
    top: 10px;
    opacity: 1;
}

.ptr-indicator.refreshing {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translateX(-50%) rotate(360deg);
    }
}

/* Mobile Sticky Header Enhancement */
.mobile-sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(14, 14, 22, 0.85);
    border-bottom: 1px solid rgba(200, 200, 240, 0.15);
    padding: var(--space-3) var(--space-4);
}

/* Mobile Card Stack Animation */
@media (max-width: 768px) {
    .mobile-card-stack>* {
        transition: transform 0.3s var(--luxury-transition-smooth),
            opacity 0.3s ease;
    }

    .mobile-card-stack>*:nth-child(1) {
        animation-delay: 0s;
    }

    .mobile-card-stack>*:nth-child(2) {
        animation-delay: 0.05s;
    }

    .mobile-card-stack>*:nth-child(3) {
        animation-delay: 0.1s;
    }

    .mobile-card-stack>*:nth-child(4) {
        animation-delay: 0.15s;
    }

    .mobile-card-stack>*:nth-child(5) {
        animation-delay: 0.2s;
    }
}

/* Gesture Navigation Aware */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .gesture-nav-aware {
        padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    }

    .gesture-nav-aware-sticky {
        bottom: env(safe-area-inset-bottom);
    }
}

/* Mobile-First Typography Adjustments */
@media (max-width: 768px) {
    .mobile-text-compact {
        font-size: 0.9em;
        line-height: 1.4;
    }

    .mobile-title-compact {
        font-size: 1.1em;
        line-height: 1.2;
    }

    /* Reduce visual noise on mobile */
    .mobile-hide-subtle {
        opacity: 0.7;
    }
}

/* Optimized Horizontal Scroll */
.mobile-scroll-h {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
}

.mobile-scroll-h::-webkit-scrollbar {
    display: none;
}

.mobile-scroll-h>* {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* Mobile Action Sheet Style */
.mobile-action-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 30, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.35s var(--luxury-transition-smooth);
    z-index: 1100;
}

.mobile-action-sheet.show {
    transform: translateY(0);
}

.mobile-action-sheet-handle {
    width: 36px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin: 0 auto var(--space-4);
}

/* Reduced Motion for Mobile */
@media (prefers-reduced-motion: reduce) {

    .haptic-feedback:active,
    .ripple-touch:active::after,
    .ptr-indicator.refreshing {
        animation: none !important;
        transition: none !important;
    }
}