/* ===== MOBILE SPECIFIC FIXES ===== */

/* Better visibility for navbar toggler */
.navbar-toggler {
  border: 2px solid rgba(255, 255, 255, 0.7) !important;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0.75rem;
}

.navbar-toggler:hover {
  background: rgba(255, 255, 255, 0.2);
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25) !important;
  outline: none;
}

/* Navbar collapse background for mobile */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background: #2c3136;
    padding: 1rem;
    margin: 0.5rem -1rem 0 -1rem;
    border-radius: 0.5rem;
  }
  
  .navbar-nav {
    padding: 0.5rem 0;
  }
  
  .navbar-nav .nav-link {
    color: #ffffff !important;
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.25rem;
  }
  
  .navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
    color: #fff !important;
  }
  
  .navbar-nav .nav-link:last-child {
    border-bottom: none;
  }
  
  /* Dropdown styling for mobile */
  .navbar .dropdown-menu {
    background: #1a1d20;
    border: none;
    box-shadow: none;
    margin-left: 1rem;
    margin-top: 0.25rem;
    padding: 0.5rem 0;
  }
  
  .navbar .dropdown-menu.show {
    display: block;
    animation: slideDown 0.3s ease;
  }
  
  .navbar .dropdown-item {
    color: #e9ecef !important;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
  }
  
  .navbar .dropdown-item:hover,
  .navbar .dropdown-item:focus {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
  }
  
  .navbar .dropdown-item i {
    width: 24px;
    display: inline-block;
    text-align: center;
    margin-right: 0.5rem;
  }
  
  /* Search form in mobile */
  .navbar form.d-flex {
    width: 100%;
    margin: 1rem 0 0.5rem 0;
    padding: 0 1rem;
  }
  
  .navbar form.d-flex .input-group {
    width: 100%;
  }
  
  .navbar form.d-flex .form-control {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
  }
  
  .navbar form.d-flex .form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
  }
  
  .navbar form.d-flex .form-control:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
  }
  
  .navbar form.d-flex .btn {
    border-color: rgba(255, 255, 255, 0.2);
  }
  
  /* Cart badge in mobile */
  .cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.65rem;
  }
}

/* Touch-friendly buttons */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .page-link,
  .nav-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  .form-control,
  .form-select {
    min-height: 44px;
  }
}

/* Prevent zoom on input focus (iOS) */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Better card stacking on mobile */
@media (max-width: 576px) {
  .card {
    margin-bottom: 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .card-header {
    padding: 0.75rem 1rem;
  }
  
  .card-footer {
    padding: 0.75rem 1rem;
  }
  
  /* Better spacing for course cards */
  .course-card {
    margin-bottom: 1.5rem;
  }
  
  .course-card .card-body {
    padding: 1rem;
  }
  
  .course-card .card-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .course-meta {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
  }
  
  /* Better button groups */
  .btn-group {
    width: 100%;
    display: flex;
  }
  
  .btn-group .btn {
    flex: 1;
    font-size: 0.85rem;
  }
  
  .btn-group-sm .btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
  }
}

/* Tablet specific fixes */
@media (min-width: 577px) and (max-width: 991px) {
  .col-md-6 .course-card {
    height: 100%;
  }
  
  .course-image {
    height: 200px;
  }
  
  .navbar-nav {
    gap: 0.25rem;
  }
}

/* Landscape mobile */
@media (max-width: 767px) and (orientation: landscape) {
  .hero-section {
    padding: 40px 0;
  }
  
  .hero-section h1 {
    font-size: 2rem;
  }
  
  .hero-image-placeholder {
    padding: 1.5rem;
  }
}

/* Animation for mobile menu */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
  .navbar-collapse {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Better table responsiveness */
@media (max-width: 576px) {
  .table-responsive {
    border: none;
  }
  
  .table {
    font-size: 0.75rem;
  }
  
  .table thead {
    display: none;
  }
  
  .table tbody tr {
    display: block;
    border: 1px solid #dee2e6;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    padding: 0.75rem;
  }
  
  .table tbody td {
    display: block;
    text-align: left;
    padding: 0.5rem 0;
    border: none;
    border-bottom: 1px solid #f0f0f0;
  }
  
  .table tbody td:last-child {
    border-bottom: none;
  }
  
  .table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    display: inline-block;
    width: 120px;
    margin-right: 10px;
  }
}

/* Better modal on mobile */
@media (max-width: 576px) {
  .modal-fullscreen-sm-down {
    max-width: 100%;
    margin: 0;
  }
  
  .modal-fullscreen-sm-down .modal-content {
    height: 100vh;
    border: none;
    border-radius: 0;
  }
  
  .modal-header .btn-close {
    margin: 0;
  }
}

/* Fix sticky elements on mobile */
@media (max-width: 768px) {
  .sticky-top {
    position: relative !important;
    top: auto !important;
  }
}

/* Better pagination on mobile */
@media (max-width: 576px) {
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .page-item {
    margin: 0.1rem;
  }
  
  .page-link {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
  
  /* Hide some pagination items on very small screens */
  .page-item:not(.active):not(:first-child):not(:last-child):not(:nth-child(2)):not(:nth-last-child(2)) {
    display: none;
  }
}

/* Fix for course detail page */
@media (max-width: 768px) {
  .course-detail .row {
    flex-direction: column-reverse;
  }
  
  .course-detail .col-lg-4 {
    margin-bottom: 2rem;
  }
}

/* Better alert messages */
@media (max-width: 576px) {
  .alert {
    font-size: 0.85rem;
    padding: 0.75rem;
  }
  
  .alert .btn-close {
    padding: 0.5rem;
  }
}

/* Improve breadcrumb on mobile */
@media (max-width: 576px) {
  .breadcrumb {
    font-size: 0.8rem;
    flex-wrap: wrap;
  }
  
  .breadcrumb-item {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Better form layout */
@media (max-width: 576px) {
  .row > [class*='col-'] {
    margin-bottom: 0.75rem;
  }
  
  .form-label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }
  
  .form-text {
    font-size: 0.8rem;
  }
}