/* ============================================================================
   CRITICAL MOBILE-FIRST RESPONSIVE IMPROVEMENTS
   ============================================================================ */

/* Mobile First - Improve all carousels for small screens */
@media (max-width: 640px) {
    #callForPapersCarousel {
        padding: 0 40px;
    }

    #callForPapersCarousel .carousel-control-prev-icon,
    #callForPapersCarousel .carousel-control-next-icon {
        width: 35px;
        height: 35px;
        padding: 8px;
    }

    #communityServiceCarousel {
        padding: 0 40px;
    }

    #communityServiceCarousel .carousel-control-prev-icon,
    #communityServiceCarousel .carousel-control-next-icon {
        width: 35px;
        height: 35px;
        padding: 8px;
    }

    #culturalExchangeCarousel {
        padding: 0 40px;
    }

    #businessCompetitionCarousel {
        padding: 0 40px;
    }

    /* Ensure navbar has proper mobile padding */
    .navbar-professional {
        padding: 0.5rem 0 !important;
    }

    .navbar-professional .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .navbar-professional .navbar-brand span {
        display: none;
    }

    .navbar-professional .nav-link {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }

    .navbar-professional .navbar-nav {
        margin-top: 0.5rem;
    }

    /* Better dropdown menu sizing for mobile */
    .dropdown-menu {
        min-width: auto;
        max-width: 100vw;
    }

    /* Improve form responsiveness */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.6rem 0.8rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }

    /* Better table scrolling on mobile */
    .table {
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    /* Improve card spacing on mobile */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Better hero section sizing */
    .hero-section,
    .call-section,
    .service-section,
    .competition-section,
    .exchange-section,
    .workshop-section {
        min-height: 60vh;
        padding: 1.5rem 1rem;
    }

    .hero-content h1,
    .call-content h2,
    .service-content h2,
    .competition-content h2,
    .exchange-content h2,
    .workshop-content h2 {
        word-break: break-word;
    }

    /* Navbar toggle button improvement */
    .navbar-toggler {
        border: none;
        padding: 0.25rem 0.5rem;
    }

    .navbar-toggler:focus {
        outline: 2px solid #90EE90;
        border-radius: 4px;
    }

    /* Improve modal on mobile */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-header {
        padding: 1rem;
    }

    /* Better alert sizing */
    .alert {
        margin-bottom: 0.75rem;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Improve list item spacing */
    .list-group-item {
        padding: 0.75rem;
    }

    /* Better pagination on mobile */
    .pagination {
        gap: 0.25rem;
    }

    .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* Touch-friendly button sizes */
    button, a.btn, input[type="submit"], input[type="button"] {
        min-height: 44px; /* Apple recommended touch target */
        min-width: 44px;
    }

    /* Improve badge sizing */
    .badge {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    /* Better spinner sizing on mobile */
    .spinner-border {
        width: 2rem;
        height: 2rem;
        border-width: 0.2em;
    }

    /* Improve breadcrumb on mobile */
    .breadcrumb {
        flex-wrap: wrap;
        gap: 0.25rem;
        font-size: 0.85rem;
    }

    .breadcrumb-item + .breadcrumb-item::before {
        padding: 0 0.25rem;
    }
}

/* Extra small devices (< 360px) */
@media (max-width: 359px) {
    .hero-content h1 {
        font-size: 1rem;
    }

    .call-content h2,
    .service-content h2,
    .competition-content h2,
    .exchange-content h2,
    .workshop-content h2 {
        font-size: 1rem;
    }

    .hero-content .subtitle {
        font-size: 0.8rem;
    }

    .navbar-professional .navbar-brand img {
        height: 28px;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .form-control,
    .form-select {
        font-size: 14px;
    }
}

/* Tablets (640px - 1024px) */
@media (min-width: 640px) and (max-width: 1024px) {
    .hero-section,
    .call-section,
    .service-section,
    .competition-section,
    .exchange-section,
    .workshop-section {
        min-height: 70vh;
    }

    .navbar-professional .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    #callForPapersCarousel {
        padding: 0 60px;
    }

    #communityServiceCarousel {
        padding: 0 60px;
    }

    #culturalExchangeCarousel {
        padding: 0 60px;
    }

    #businessCompetitionCarousel {
        padding: 0 60px;
    }

    .form-control,
    .form-select {
        font-size: 15px;
    }
}

/* Landscape mode optimization */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section,
    .call-section,
    .service-section,
    .competition-section,
    .exchange-section,
    .workshop-section {
        min-height: 100vh;
        padding: 1rem;
    }

    .hero-content,
    .call-content,
    .service-content,
    .competition-content,
    .exchange-content,
    .workshop-content {
        padding: 1rem;
    }

    .hero-content h1,
    .call-content h2,
    .service-content h2,
    .competition-content h2,
    .exchange-content h2,
    .workshop-content h2 {
        margin-bottom: 0.5rem;
    }
}

/* Print styles for better printing */
@media print {
    .navbar-professional,
    .admin-navbar,
    .user-navbar,
    .site-footer,
    .navbar {
        display: none !important;
    }

    body {
        background: white;
    }

    .container {
        max-width: 100%;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    button, a.btn {
        border: 2px solid currentColor;
    }

    .navbar-professional {
        border-bottom: 2px solid #000;
    }

    .card {
        border: 2px solid #000;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* This can be implemented based on your design needs */
}

/* Fix for Samsung Internet and older browsers */
.btn-success {
    -webkit-appearance: none;
    appearance: none;
}

/* Ensure touch target size */
a[href], button, input[type="button"], input[type="submit"], input[type="reset"] {
    touch-action: manipulation;
}

/* Better text sizing for mobile */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    h4 {
        font-size: 1rem;
    }

    h5 {
        font-size: 0.95rem;
    }

    h6 {
        font-size: 0.9rem;
    }
}

/* Better spacing for small screens */
.container-sm {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Improve input focus states */
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #90EE90;
    outline-offset: 2px;
}

/* Better scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Fix for input autocomplete styling */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px white inset !important;
    -webkit-text-fill-color: #333 !important;
}

/* Improve performance with will-change */
.navbar-professional {
    will-change: scroll-position;
}

.admin-sidebar,
.user-sidebar {
    will-change: transform;
}

/* Reduce motion for animations on slow devices */
@media (max-width: 640px) {
    * {
        scroll-behavior: auto !important;
    }
}
