/* ============================================================
   ColWebSol — Production mobile & responsive layer
   Load last; overrides conflicting legacy rules
   ============================================================ */

/* --- Global --- */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.index-page,
body.inner-page {
    overflow-x: clip;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Safe area for notched devices */
.header,
.scroll-top {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.scroll-top {
    bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
    right: calc(1rem + env(safe-area-inset-right)) !important;
}

.scroll-top.active {
    bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
    right: calc(1rem + env(safe-area-inset-right)) !important;
}

/* --- Main content --- */
.main {
    margin: 0 auto;
    padding: 0;
    max-width: 100%;
}

.main .section {
    padding: 3rem 0;
}

body.inner-page .main .section {
    padding: 2.5rem 0 3rem;
}

.section-title {
    padding-bottom: clamp(1.25rem, 4vw, 2.5rem) !important;
    text-align: center;
}

.section-title p {
    margin-bottom: 0.5rem;
}

/* --- Header (mobile) --- */
@media (max-width: 1199.98px) {
    .header {
        padding: 0.5rem 0;
    }

    .header .container {
        padding-left: 1rem;
        padding-right: 1rem;
        min-height: 52px;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .header .logo {
        flex: 1 1 auto;
        min-width: 0;
        max-width: calc(100% - 52px);
        padding: 0.3rem 0;
    }

    #header-logo,
    img#header-logo {
        width: 40px;
        height: 40px;
        max-height: 40px;
        object-fit: contain;
        flex-shrink: 0;
        margin-right: 0 !important;
    }

    .brand-title-line1 {
        font-size: clamp(0.8rem, 3.4vw, 0.95rem);
        line-height: 1.15;
    }

    .brand-title-line2 {
        font-size: clamp(0.72rem, 3vw, 0.85rem);
        line-height: 1.15;
    }

    .navmenu {
        flex-shrink: 0;
        position: static !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        padding: 0 !important;
    }

    body:not(.mobile-nav-active) .navmenu > ul {
        display: none !important;
    }

    .mobile-nav-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin: 0;
        border: none;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.12);
        color: #fff;
        font-size: 1.5rem;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    body.mobile-nav-active {
        overflow: hidden;
    }
}

/* --- Hero --- */
.hero {
    min-height: clamp(320px, 62vh, 720px);
}

.hero .container {
    padding-left: 1rem;
    padding-right: 1rem;
}

#header-text,
.hero-content {
    text-align: center;
    max-width: 44rem;
    margin: 0 auto;
}

/* --- About / principal --- */
.about .principal-photo {
    margin: 0 auto 1.5rem;
    display: block;
    border-width: 4px;
}

.about .principal-message {
    font-size: clamp(0.95rem, 2.5vw, 1.05rem);
}

/* --- Stats --- */
.stats-item {
    padding: 1.25rem 0.75rem;
}

.stats-item span {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
}

/* --- Cards & grids --- */
.program-card,
.video-card,
.faculty-card {
    margin-bottom: 0;
}

.faculty-wrapper {
    padding: 1rem;
}

.faculty-card .table {
    font-size: 0.85rem;
}

.faculty-card .table th {
    width: 38%;
}

@media (max-width: 767.98px) {
    .faculty-card .table th {
        white-space: normal;
        width: 42%;
        vertical-align: top;
    }

    .faculty-card .table td {
        word-break: break-word;
    }
}

/* --- Gallery swiper mobile --- */
@media (max-width: 767.98px) {
    .gallery-swiper .swiper-button-prev,
    .gallery-swiper .swiper-button-next {
        display: none;
    }

    .gallery-slide img {
        height: clamp(200px, 40vw, 260px);
    }
}

/* --- Footer --- */
.site-footer.footer {
    padding-bottom: 0 !important;
}

.site-footer .footer-top {
    padding: 1rem 0 0.5rem !important;
}

.site-footer .footer-about .sitename,
.site-footer .footer-brand-line1 {
    font-size: 0.95rem;
    line-height: 1.2;
}

.site-footer .footer-links-heading {
    font-size: 0.92rem;
    margin-bottom: 0.35rem;
}

@media (max-width: 767.98px) {
    .site-footer.footer .footer-links ul a {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.25rem 0;
    }
}

.site-footer .map-container {
    height: min(220px, 38vh);
}

.site-footer .map-container iframe {
    height: 100% !important;
}

@media (max-width: 575.98px) {
    .site-footer .footer-about {
        padding-bottom: 0.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 0.25rem;
    }

    .site-footer .footer-links {
        margin-bottom: 0.5rem;
    }
}

/* --- Inner public pages --- */
.main .container.py-5,
.main > .container {
    padding-left: 1rem;
    padding-right: 1rem;
}

.main .display-6 {
    font-size: clamp(1.35rem, 5vw, 2rem);
}

/* --- Urdu on mobile --- */
.urdu p {
    font-size: clamp(1.1rem, 4vw, 1.35rem) !important;
}

/* --- Touch targets (navigation) --- */
@media (max-width: 1199.98px) {
    .navmenu a,
    .navmenu .dropdown > ul a {
        min-height: 44px;
        align-items: center;
    }
}

/* --- Admin mobile --- */
@media (max-width: 991.98px) {
    body.admin-body .admin-navbar .navbar-brand {
        max-width: 55vw;
        font-size: 0.95rem;
    }

    body.admin-body .admin-main-content {
        padding: 1rem;
        border-radius: 0.5rem;
        margin: 0 -0.25rem;
    }

    body.admin-body .admin-page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    body.admin-body .admin-page-header h1 {
        font-size: 1.25rem;
    }

    body.admin-body .section-admin-card .card-body form .col-md-1,
    body.admin-body .section-admin-card .card-body form .col-md-2 {
        margin-bottom: 0.5rem;
    }

    body.admin-body .table-responsive {
        font-size: 0.875rem;
    }
}

@media (max-width: 575.98px) {
    .hero {
        min-height: clamp(300px, 58vh, 480px);
    }

    .section-title .btn {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .counts .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* --- Desktop refinements --- */
@media (min-width: 1200px) {
    .header .logo {
        max-width: min(42%, 22rem);
    }

    #header-logo {
        max-height: 44px;
        width: auto;
    }

    .brand-title-line1 {
        white-space: nowrap;
    }

    .brand-title-line2 {
        white-space: nowrap;
    }

    .hero-content {
        text-align: left;
        margin: 0;
        max-width: 52rem;
    }

    .hero .hero-logo,
    .hero img#logoImg {
        margin-left: 0 !important;
        margin-right: auto !important;
    }
}

/* ============================================================
   Mobile UI polish (forms, content, contact, inner headers)
   ============================================================ */

@media (max-width: 767.98px) {
    body.index-page,
    body.inner-page {
        font-size: 16px;
    }

    .form-control,
    .form-select,
    .input-group-lg .form-control,
    textarea.form-control {
        font-size: 16px;
    }

    .custom-page-content,
    .content-card-text,
    .principal-message,
    .event-description-panel,
    .content-card-title {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .custom-page-content table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .contact-email-group .btn,
    .contact-otp-group .btn,
    .btn-contact-primary,
    .btn-contact-success {
        width: 100%;
        min-height: 48px;
        margin-top: 0.5rem;
    }

    .inner-page .section-title.inner-page-header {
        padding-bottom: clamp(1rem, 3vw, 1.75rem) !important;
    }

    .main .section {
        padding: 2rem 0;
    }

    body.inner-page .main .section {
        padding: 1.75rem 0 2.25rem;
    }

    .contact.section {
        padding-bottom: 2rem;
    }

    .contact-info-card {
        padding: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .contact-step-indicator {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .contact-step-indicator li {
        white-space: normal;
    }

    .letter-spacing-otp {
        letter-spacing: 0.2em;
        font-size: 1.1rem;
    }

    .download-item-action {
        width: 100%;
        padding-left: 0;
        margin-top: 0.5rem;
    }

    .downloads-search {
        font-size: 16px;
    }

    .hub-header-icon {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1.2rem;
    }
}
