/* Mobile-specific CSS Bundle */

/* Enhanced Responsive Design - Mobile First Approach */

/* Extra small devices (phones, 576px and down) */
@media (max-width: 575.98px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .hero-section {
        padding: 1.5rem 1rem !important;
        margin: 0.5rem 0;
        border-radius: 15px;
    }

    .hero-section h1 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }

    .hero-section p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Touch-friendly navigation */
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
        border-radius: 8px;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }

    /* Form improvements for mobile */
    .form-control, .form-select {
        padding: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .form-floating > label {
        padding: 1rem 0.75rem;
    }

    /* Table responsive improvements */
    .table-responsive {
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    /* Lesson cards mobile optimization */
    .lesson-card {
        margin-bottom: 1rem;
    }

    .lesson-card .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .lesson-card .card-body {
        padding: 1rem;
    }

    .lesson-card .lesson-price {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }

    /* Toast notifications for mobile */
    .toast {
        min-width: 280px;
        margin-bottom: 0.5rem;
    }

    #toast-container {
        padding: 1rem;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .hero-section {
        padding: 2rem 1.5rem !important;
        border-radius: 20px;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section p {
        font-size: 1.1rem;
    }

    .card {
        margin-bottom: 1.5rem;
    }

    .lesson-card .card-header {
        padding: 1rem 1.25rem;
    }

    .lesson-card .card-body {
        padding: 1.25rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .btn, .card, .nav-link {
        transition: none; /* Disable hover animations on touch */
    }

    .card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(79, 99, 210, 0.08);
    }

    .lesson-card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(79, 99, 210, 0.08);
    }

    /* Larger touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .form-control, .form-select {
        min-height: 44px;
    }

    .dropdown-item {
        padding: 0.75rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Remove hover effects that don't work on touch */
    .btn:hover {
        transform: none;
    }

    /* Touch-friendly spacing */
    .btn + .btn {
        margin-left: 0.75rem;
    }

    /* Simplified animations */
    * {
        transition-duration: 0.2s !important;
    }
}

/* Mobile Navigation */
.navbar-toggler {
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Mobile-first breakpoints */
@media (max-width: 575.98px) {
    /* Extra small devices (phones) */
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card {
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 12px;
    }

    /* Stack form elements vertically */
    .row.g-3 > .col {
        margin-bottom: 1rem;
    }

    /* Larger touch targets */
    .btn, .form-control, .form-select {
        min-height: 48px;
    }

    /* Simplified navigation */
    .navbar-nav {
        text-align: center;
    }

    .navbar-nav .nav-link {
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Hide complex elements on mobile */
    .d-none-mobile {
        display: none !important;
    }

    /* Simplified tables */
    .table-responsive-mobile {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive-mobile .table {
        margin-bottom: 0;
        font-size: 0.875rem;
    }

    /* Mobile-optimized forms */
    .form-floating {
        margin-bottom: 1.5rem;
    }

    .form-floating .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media (max-width: 767.98px) {
    /* Small devices (landscape phones) */

    /* Responsive typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }

    /* Responsive spacing */
    .py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }

    .my-5 { margin-top: 2rem !important; margin-bottom: 2rem !important; }
    .my-4 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }

    /* Mobile navigation */
    .navbar-brand {
        font-size: 1.25rem;
    }

    .navbar-toggler {
        border: none;
        padding: 0.5rem;
    }

    /* Responsive buttons */
    .btn {
        padding: 0.625rem 1.25rem;
    }

    /* Mobile-friendly dropdowns */
    .dropdown-menu {
        border-radius: 12px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    }

    /* Responsive modals */
    .modal-dialog {
        max-width: calc(100vw - 2rem);
    }

    /* Touch-friendly pagination */
    .pagination .page-link {
        padding: 0.75rem 1rem;
        margin: 0 0.125rem;
    }
}

/* Touch device optimizations */
.touch-device .btn {
    min-height: 44px;
    min-width: 44px;
}

.touch-device .form-control {
    min-height: 44px;
}

.touch-device .nav-link {
    padding: 1rem;
}

.touch-device .dropdown-item {
    padding: 0.75rem 1rem;
}

/* Mobile-optimized classes */
.mobile-optimized .btn {
    font-size: 16px;
    padding: 0.75rem 1rem;
}

.mobile-optimized .form-control {
    font-size: 16px;
}

.mobile-optimized .card-body {
    padding: 1rem;
}

.mobile-optimized .modal-dialog {
    margin: 0.5rem;
}

/* Utility classes for responsive design */
.d-none-mobile {
    display: block;
}

@media (max-width: 575.98px) {
    .d-none-mobile {
        display: none !important;
    }
}

.d-block-mobile {
    display: none;
}

@media (max-width: 575.98px) {
    .d-block-mobile {
        display: block !important;
    }
}

/* Enhanced Mobile Navigation */
@media (max-width: 991.98px) {
    .navbar-toggler {
        border: none;
        padding: 0.5rem;
        border-radius: 8px;
        min-height: 44px;
        min-width: 44px;
        background: rgba(255, 255, 255, 0.1);
    }

    .navbar-collapse {
        background: rgba(79, 99, 210, 0.95);
        margin: 0.5rem -1rem 0;
        padding: 1rem;
        border-radius: 8px;
        backdrop-filter: blur(10px);
    }

    .navbar-nav {
        gap: 0.25rem;
    }

    .navbar-nav .nav-link {
        color: white !important;
        padding: 0.75rem 1rem;
        border-radius: 6px;
        transition: background-color 0.2s ease;
    }

    .navbar-nav .nav-link:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* Enhanced Mobile Forms */
@media (max-width: 575.98px) {
    .form-floating {
        margin-bottom: 1.5rem;
    }

    .form-floating .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 48px;
        border-radius: 8px;
    }

    .form-floating > label {
        padding: 1rem 0.75rem;
        font-size: 0.9rem;
    }

    .form-check {
        margin-bottom: 1rem;
    }

    .form-check-input {
        margin-top: 0.125rem;
    }

    /* Full-width buttons on mobile */
    .btn:not(.btn-sm):not(.btn-xs) {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        border-radius: 8px !important;
        margin-bottom: 0.25rem;
    }
}

/* Enhanced Mobile Modals */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
        height: calc(100vh - 1rem);
    }

    .modal-content {
        border-radius: 12px;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-header {
        border-bottom: 1px solid #dee2e6;
        padding: 1rem;
    }

    .modal-footer {
        border-top: 1px solid #dee2e6;
        padding: 1rem;
    }
}

/* Enhanced Mobile Tables */
@media (max-width: 767.98px) {
    .table-responsive {
        border-radius: 8px;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .table {
        font-size: 0.875rem;
        margin-bottom: 0;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }

    .table th {
        font-size: 0.8rem;
        font-weight: 600;
    }

    /* Hide less important columns on mobile */
    .table .d-none-mobile {
        display: none !important;
    }
}

/* Touch Gesture Animations */
@keyframes swipe-left {
    0% { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes swipe-right {
    0% { transform: translateX(-100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.swipe-transition-overlay {
    animation-duration: 0.3s;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

/* Pull to Refresh Styles */
.pull-refresh-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: opacity 0.2s ease;
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 9999;
    min-width: 150px;
    overflow: hidden;
    animation: contextMenuAppear 0.2s ease-out;
}

@keyframes contextMenuAppear {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.context-menu-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
}

.context-menu-item:hover {
    background-color: #f8f9fa;
}

.context-menu-item:active {
    background-color: #e9ecef;
}

/* Pinch to Zoom Styles */
.zoomable {
    transition: transform 0.3s ease;
    transform-origin: center;
}

.zoomable.zoomed {
    cursor: grab;
}

.zoomable.zoomed:active {
    cursor: grabbing;
}

/* Long Press Feedback */
.long-press-active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Touch Ripple Effect */
.touch-ripple {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Haptic Feedback Simulation */
.haptic-feedback {
    animation: hapticPulse 0.1s ease;
}

@keyframes hapticPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Swipe Navigation Indicators */
.swipe-nav-indicator {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(79, 99, 210, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.swipe-nav-indicator.left {
    left: 20px;
}

.swipe-nav-indicator.right {
    right: 20px;
}

.swipe-nav-indicator.active {
    opacity: 1;
    animation: swipeIndicatorPulse 0.5s ease;
}

@keyframes swipeIndicatorPulse {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.2); }
    100% { transform: translateY(-50%) scale(1); }
}
