/* =====================================
   MOBILE RESPONSIVENESS FIXES
   Emrald Medical - Frontend + Admin
   Fixes for all screen sizes
   ===================================== */

/* ========== FRONTEND FIXES ========== */

/* Top bar - hide clock text on very small screens, stack contact info */
@media (max-width: 575px) {
    .top-bar .contact-info {
        font-size: 0.75rem;
        gap: 0.5rem;
        justify-content: center;
    }
    .top-bar .contact-info span:last-child {
        display: none !important; /* Hide hours on very small screens */
    }
    .top-bar .social-links a {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}

/* Navbar brand text fix */
@media (max-width: 767px) {
    .navbar-brand .brand-text {
        font-size: 1rem;
    }
    .navbar-brand .brand-text small {
        font-size: 0.6rem;
    }
    .navbar-brand img {
        max-height: 38px;
    }
}

/* Hero section mobile fixes */
@media (max-width: 767px) {
    .hero-slide {
        min-height: 70vh;
        padding: 3rem 0;
    }
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    .hero-description {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    .hero-badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        margin-bottom: 1rem;
    }
    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    .hero-buttons .btn-primary,
    .hero-buttons .btn-outline {
        width: 100%;
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
        text-align: center;
        justify-content: center;
    }
    .hero-stats {
        gap: 1rem;
        margin-top: 1.5rem;
        padding-top: 1.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    .hero-stat {
        min-width: 80px;
    }
    .hero-stat-number {
        font-size: 1.5rem;
    }
    .hero-stat-label {
        font-size: 0.7rem;
    }
}

@media (max-width: 400px) {
    .hero-title {
        font-size: 1.5rem;
    }
    .hero-stats {
        gap: 0.75rem;
    }
    .hero-stat-number {
        font-size: 1.25rem;
    }
}

/* Info cards stack properly */
@media (max-width: 575px) {
    .info-cards-section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    .info-card {
        padding: 1.25rem;
    }
    .info-card-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    .info-card h5 {
        font-size: 0.95rem;
    }
    .info-card p {
        font-size: 0.8rem;
    }
}

/* Service cards - full width on mobile */
@media (max-width: 575px) {
    .service-card-header {
        padding: 1.5rem;
    }
    .service-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    .service-card-body {
        padding: 1rem !important;
    }
    .service-card-body h5 {
        font-size: 1rem;
    }
    .service-card-body p {
        font-size: 0.8rem;
    }
}

/* Doctor cards mobile */
@media (max-width: 575px) {
    .doctor-image {
        height: 200px;
    }
    .doctor-card-body {
        padding: 1rem !important;
    }
    .doctor-card-body h5 {
        font-size: 1rem;
    }
    .doctor-qualification {
        font-size: 0.7rem;
    }
}

/* CTA section mobile */
@media (max-width: 767px) {
    .cta-section {
        padding: 2.5rem 0;
        text-align: center;
    }
    .cta-section h2 {
        font-size: 1.5rem;
    }
    .cta-buttons {
        justify-content: center;
        flex-direction: column;
        align-items: center;
    }
    .cta-buttons .btn-light,
    .cta-buttons .btn-outline-light {
        width: 100%;
        max-width: 280px;
    }
}

/* Page header mobile */
@media (max-width: 767px) {
    .page-header {
        padding: 2.5rem 0 2rem;
    }
    .page-header h1 {
        font-size: 1.75rem;
    }
    .page-header .lead {
        font-size: 0.9rem;
    }
}

/* Services page - category nav scroll on mobile */
@media (max-width: 767px) {
    .d-flex.flex-wrap.gap-2.justify-content-center {
        justify-content: flex-start;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        scrollbar-width: thin;
    }
    .d-flex.flex-wrap.gap-2.justify-content-center .btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Footer mobile fixes */
@media (max-width: 767px) {
    .footer {
        padding-top: 2.5rem;
    }
    .footer .col-lg-4,
    .footer .col-lg-2,
    .footer .col-lg-3 {
        margin-bottom: 1.5rem;
    }
    .footer h5 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    .footer-links a {
        font-size: 0.85rem;
    }
    .footer-social {
        justify-content: center;
    }
    .footer-social a {
        width: 36px;
        height: 36px;
    }
    .footer-bottom {
        text-align: center;
    }
    .footer-bottom p {
        font-size: 0.8rem;
    }
}

/* Contact page map fix */
@media (max-width: 767px) {
    .contact-info-card {
        margin-bottom: 1rem;
    }
    iframe {
        min-height: 300px;
    }
}

/* About page mobile */
@media (max-width: 767px) {
    .about-image-wrapper {
        margin-bottom: 2rem;
    }
    .about-features {
        gap: 0.75rem;
    }
}

/* Forms on mobile */
@media (max-width: 575px) {
    .form-card-body,
    .appointment-form-body {
        padding: 1.25rem;
    }
    .form-control, .form-select {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
}

/* Bank details card mobile */
@media (max-width: 575px) {
    .card-body.p-4.p-md-5 {
        padding: 1.25rem;
    }
}

/* WhatsApp + scroll-to-top position fix for small screens */
@media (max-width: 575px) {
    .whatsapp-float {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
        bottom: 16px;
        right: 16px;
    }
    .scroll-to-top {
        width: 40px;
        height: 40px;
        bottom: 72px;
        right: 16px;
        font-size: 0.8rem;
    }
}

/* Fix Bootstrap dropdown on mobile */
@media (max-width: 991px) {
    .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        border: none;
        box-shadow: none;
        background: var(--gray-50, #f9fafb);
        border-radius: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .dropdown-item {
        padding: 0.5rem 1.5rem;
    }
}

/* Fix table overflow on mobile */
@media (max-width: 767px) {
    .table-responsive {
        font-size: 0.8rem;
    }
    .table thead th {
        font-size: 0.7rem;
        padding: 0.5rem;
        white-space: nowrap;
    }
    .table tbody td {
        padding: 0.5rem;
    }
}

/* Breadcrumb mobile */
@media (max-width: 575px) {
    .breadcrumb {
        font-size: 0.8rem;
    }
}

/* General text scaling */
@media (max-width: 575px) {
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.2rem !important; }
    .lead { font-size: 0.95rem; }
    .section { padding: 2.5rem 0 !important; }
    .section-header { margin-bottom: 1.5rem; }
    .section-description { font-size: 0.9rem; }
}


/* ========== ADMIN PANEL FIXES ========== */

/* Admin sidebar overlay on mobile instead of pushing content */
@media (max-width: 991px) {
    #sidebar-wrapper {
        position: fixed;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        margin-left: 0 !important;
    }
    #sidebar-wrapper.toggled {
        transform: translateX(0);
        margin-left: 0 !important;
    }
    #page-content-wrapper {
        margin-left: 0 !important;
    }
    #wrapper.toggled #page-content-wrapper {
        margin-left: 0 !important;
    }
    /* Backdrop overlay when sidebar is open */
    #sidebar-wrapper.toggled::after {
        content: '';
        position: fixed;
        top: 0;
        left: var(--sidebar-width);
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: -1;
    }
}

/* Admin container padding on mobile */
@media (max-width: 767px) {
    .container-fluid.p-4 {
        padding: 0.75rem !important;
    }
    .container-fluid h1 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
}

/* Admin stats cards - 2 per row on mobile */
@media (max-width: 575px) {
    .stats-card {
        padding: 1rem !important;
    }
    .stats-card h3 {
        font-size: 1.5rem;
    }
    .stats-card p {
        font-size: 0.75rem;
    }
    .stats-card .icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

/* Admin card on mobile */
@media (max-width: 767px) {
    .card-header {
        padding: 0.75rem 1rem;
    }
    .card-header h5 {
        font-size: 0.9rem;
    }
    .card-body {
        padding: 1rem !important;
    }
}

/* Admin form rows on mobile - full width */
@media (max-width: 575px) {
    .card-body .row .col-md-3,
    .card-body .row .col-md-4,
    .card-body .row .col-md-6 {
        margin-bottom: 0.75rem;
    }
}

/* Admin quick actions scroll on mobile */
@media (max-width: 767px) {
    .quick-actions {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        gap: 0.5rem;
    }
    .quick-action-btn {
        flex-shrink: 0;
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }
    .quick-action-btn span {
        white-space: nowrap;
    }
}

/* Admin table buttons on mobile */
@media (max-width: 575px) {
    .btn-group .btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
    }
    .dropdown-menu {
        min-width: 160px;
    }
}

/* Admin appointment filters stack on mobile */
@media (max-width: 767px) {
    .card-body form.row.g-3 .col-md-2,
    .card-body form.row.g-3 .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Admin nav tabs scroll on mobile */
@media (max-width: 767px) {
    .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-tabs::-webkit-scrollbar {
        display: none !important;
    }
    .nav-tabs .nav-link {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Admin modals on mobile */
@media (max-width: 575px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    .modal-body {
        padding: 1rem !important;
    }
    .modal-body .row .col-md-6 {
        margin-bottom: 0.5rem;
    }
}

/* Admin sidebar scrollable on short screens */
@media (max-height: 700px) {
    #sidebar-wrapper .list-group-flush {
        overflow-y: auto;
        max-height: calc(100vh - 60px);
    }
}

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

/* Print-friendly */
@media print {
    .top-bar, .navbar, .whatsapp-float, .scroll-to-top, .footer,
    #sidebar-wrapper, .navbar, .btn, .quick-actions {
        display: none !important;
    }
    #page-content-wrapper {
        margin-left: 0 !important;
    }
    body {
        background: white;
    }
    .hero-section {
        min-height: auto;
        padding: 1rem 0;
    }
}
