/* Mobile-First PWA Styles for CollegeVaani */

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    display: none; /* Hidden by default, shown on mobile */
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 8px 0;
    z-index: 9999;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }
    
    /* Add padding to body to prevent content being hidden */
    body {
        padding-bottom: 70px \!important;
    }
    
    main {
        padding-bottom: 20px;
    }
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #6b7280;
    font-size: 11px;
    font-weight: 500;
    position: relative;
    padding: 6px 12px;
    min-width: 60px;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.mobile-bottom-nav .nav-item i {
    font-size: 20px;
    margin-bottom: 3px;
    transition: all 0.2s ease;
}

.mobile-bottom-nav .nav-item span:not(.badge) {
    font-size: 10px;
    margin-top: 2px;
}

.mobile-bottom-nav .nav-item.active {
    color: #667eea;
}

.mobile-bottom-nav .nav-item.active i {
    transform: scale(1.1);
}

.mobile-bottom-nav .nav-item:active {
    background: rgba(102, 126, 234, 0.1);
}

.mobile-bottom-nav .badge {
    position: absolute;
    top: 2px;
    right: 8px;
    background: #ef4444;
    color: white;
    border-radius: 10px;
    padding: 2px 5px;
    font-size: 9px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
    line-height: 1.2;
}

/* Touch-Optimized Interface */
@media (max-width: 768px) {
    /* Minimum touch target size (44x44px per Apple/Google guidelines) */
    .btn, 
    button:not(.close):not(.btn-close), 
    a.btn,
    .card-actions .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px \!important;
        font-size: 14px;
    }
    
    /* Larger form inputs to prevent zoom on iOS */
    .form-control, 
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="search"],
    textarea {
        min-height: 48px;
        font-size: 16px \!important; /* Prevents iOS zoom */
        padding: 12px 16px;
    }
    
    /* Better card spacing */
    .university-card {
        margin-bottom: 20px \!important;
    }
    
    /* Full-width modals on mobile */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }
    
    .modal-content {
        height: 100%;
        border-radius: 0;
        border: none;
    }
    
    .modal-header {
        padding: 15px 20px;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .modal-body {
        padding: 20px;
        overflow-y: auto;
    }
    
    /* Swipeable carousels */
    .university-carousel,
    .course-carousel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        display: flex;
        gap: 15px;
        padding: 10px 0;
    }
    
    .university-carousel .card,
    .course-carousel .card {
        scroll-snap-align: start;
        flex: 0 0 85%;
        min-width: 280px;
    }
    
    /* Better link targets */
    a:not(.btn) {
        min-height: 32px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Larger checkboxes and radio buttons */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        cursor: pointer;
    }
    
    /* Navigation improvements */
    .navbar-toggler {
        min-height: 44px;
        min-width: 44px;
        padding: 10px;
    }
    
    /* Better table display */
    table {
        font-size: 14px;
    }
    
    table td,
    table th {
        padding: 12px 8px;
    }
    
    /* Hide desktop-only elements */
    .desktop-only {
        display: none \!important;
    }
    
    /* Stack elements vertically */
    .card-actions {
        flex-direction: column \!important;
        gap: 10px \!important;
    }
    
    .card-actions .btn {
        width: 100%;
    }
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 70px;
    left: 10px;
    right: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    align-items: center;
    gap: 15px;
    z-index: 9998;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pwa-install-banner.show {
    display: flex;
}

.pwa-install-banner .icon {
    font-size: 32px;
}

.pwa-install-banner .content {
    flex: 1;
}

.pwa-install-banner .content h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
}

.pwa-install-banner .content p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.pwa-install-banner .btn-install {
    background: white;
    color: #667eea;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.pwa-install-banner .btn-close-banner {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f59e0b;
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    z-index: 99999;
    display: none;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.offline-indicator.show {
    display: block;
}

.offline-indicator i {
    margin-right: 8px;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

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

/* Pull to Refresh (visual feedback) */
.pull-to-refresh {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    background: white;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    color: #667eea;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    transition: transform 0.3s ease;
}

.pull-to-refresh.active {
    display: flex;
    transform: translateX(-50%) translateY(10px);
}

.pull-to-refresh i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    .mobile-bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    @media (max-width: 768px) {
        body {
            padding-bottom: max(70px, calc(70px + env(safe-area-inset-bottom))) \!important;
        }
    }
}

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

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms \!important;
        animation-iteration-count: 1 \!important;
        transition-duration: 0.01ms \!important;
        scroll-behavior: auto \!important;
    }
}

/* Dark Mode Support (Future) */
@media (prefers-color-scheme: dark) {
    .mobile-bottom-nav {
        background: #1f2937;
        border-top-color: #374151;
    }
    
    .mobile-bottom-nav .nav-item {
        color: #9ca3af;
    }
    
    .mobile-bottom-nav .nav-item.active {
        color: #818cf8;
    }
}
