/* 
 * 💎 SENSEI PREMIUM RESPONSIVE FRAMEWORK
 * Mobile-First UX/UI Optimizations
 */

:root {
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

/* 📱 1. Global Typography & Spacing Scaling */
html {
    font-size: 15px; /* Base for mobile */
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

h1, .h1 { font-size: 1.75rem; font-weight: 800; }
h2, .h2 { font-size: 1.5rem; font-weight: 800; }
h3, .h3 { font-size: 1.25rem; font-weight: 700; }

@media (min-width: 768px) {
    h1, .h1 { font-size: 2.25rem; }
    h2, .h2 { font-size: 1.85rem; }
}

/* 📱 2. Touch Optimization */
button, .btn, .nav-link, .sidebar-link, a {
    min-height: 44px; /* Apple/Google standard */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.btn-sm, .btn-xs {
    min-height: 32px;
}

/* 📱 3. Responsive Table Transformation (Cards on Mobile) */
@media (max-width: 767px) {
    .table-responsive-stack .thead, 
    .table-responsive-stack thead {
        display: none;
    }

    .table-responsive-stack tr {
        display: block;
        background: #fff;
        border: 1px solid #edf2f7;
        border-radius: 12px;
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }

    .table-responsive-stack td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none !important;
        text-align: right;
    }

    .table-responsive-stack td::before {
        content: attr(data-label);
        font-weight: 800;
        text-transform: uppercase;
        font-size: 0.65rem;
        color: #94a3b8;
        text-align: left;
        margin-right: 1rem;
    }
}

/* 📱 4. Mobile Menu & Navigation Fixes */
@media (max-width: 991px) {
    .sidebar {
        z-index: 2000 !important;
    }
    .main {
        width: 100% !important;
        margin-left: 0 !important;
    }
    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        z-index: 1999;
        display: none;
    }
    body.sidebar-open .sidebar-overlay {
        display: block;
    }
}

/* 📱 5. Premium Skeletons for Loading States */
.skeleton {
    background: linear-gradient(90deg, #f0f2f5 25%, #e2e8f0 50%, #f0f2f5 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite ease-in-out;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 📱 6. Video Player Mobile Optimization */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 16px;
    background: #000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.video-container iframe, 
.video-container video,
.video-container .plyr {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}

/* 📱 7. Keyboard Overlap Fixes */
input:focus, textarea:focus {
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
}

/* 📱 8. Sticky Mobile Actions (Optional) */
.mobile-action-bar {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + var(--safe-area-inset-bottom));
    border-top: 1px solid #edf2f7;
    z-index: 1000;
    justify-content: space-around;
}

@media (max-width: 576px) {
    .mobile-action-bar { display: flex; }
    .footer { padding-bottom: 80px !important; }
}

/* 📱 9. Modern Forms */
.form-control, .form-select {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--sensei-red);
    box-shadow: 0 0 0 3px rgba(216, 50, 54, 0.1);
}

/* 📱 10. Smooth Page Transitions */
.page-loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #fff;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.page-loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}
