/* ============================================
   COMPREHENSIVE RESPONSIVE UI FIXES
   Header & Footer Optimization for All Screen Sizes
   Mobile/Tablet/Desktop/Projector/Ultra-Wide Support
   ============================================ */

/* ============================================
   ROOT VARIABLES & BASE FIXES
   ============================================ */
:root {
    --header-height-mobile: 70px;
    --header-height-tablet: 80px;
    --header-height-desktop: 90px;
    --footer-padding-mobile: 2rem;
    --footer-padding-desktop: 3rem;
}

/* ============================================
   HEADER/NAVBAR BASE STYLES
   ============================================ */
.modern-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    width: 100%;
}

.nav-modern {
    padding: 0.5rem 0;
    min-height: 60px;
}

/* ============================================
   LOGO & BRAND RESPONSIVE FIXES
   ============================================ */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0;
    max-width: 100%;
    flex-shrink: 1;
}

.logo-container {
    flex-shrink: 0;
}

.logo-img {
    height: 45px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.company-name {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 430px;
}

.tagline {
    font-size: 0.7rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   NAVBAR TOGGLER FIXES
   ============================================ */
.navbar-toggler {
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.5);
}

.navbar-toggler:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   NAVIGATION MENU FIXES
   ============================================ */
.navbar-nav {
    gap: 0.5rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    padding: 0.5rem 0.85rem !important;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9) !important;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 215, 0, 0.25) !important;
    color: #FFD700 !important;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    transform: translateY(-1px);
}

/* ============================================
   SERVICES MEGA MENU FIXES
   ============================================ */
.mega-services-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 280px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1031;
    margin-top: 0.5rem;
    padding: 0.5rem;
}

.services-mega:hover .mega-services-menu,
.language-mega:hover .mega-services-menu {
    display: block;
}

.services-sub-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-sub-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 1rem;
    color: #2d3748;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.25s ease;
    font-size: 0.9rem;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    font-weight: 500;
}

.mega-sub-link:hover {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%) !important;
    color: white !important;
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(30, 60, 114, 0.3);
}

.mega-sub-link:hover i {
    color: #FFD700 !important;
}

.mega-sub-link i {
    margin-right: 0.5rem;
    width: 20px;
}

/* ============================================
   HEADER CONTROL BAR (Language + Auth)
   ============================================ */
.header-control-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ============================================
   FOOTER BASE FIXES
   ============================================ */
.modern-footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding-top: var(--footer-padding-mobile);
    padding-bottom: 1.5rem;
    margin-top: auto;
}

.modern-footer h5 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.modern-footer h5::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #FFD700, transparent);
}

.modern-footer ul {
    padding-left: 0;
}

.modern-footer ul li {
    margin-bottom: 0.75rem;
}

.modern-footer a:hover {
    color: #FFD700 !important;
    transform: translateX(5px);
    display: inline-block;
    transition: all 0.3s ease;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* ============================================
   FOOTER SOCIAL LINKS
   ============================================ */
.footer-social-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.footer-social-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

.footer-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    border: 2px solid transparent;
    will-change: background, box-shadow, border-color;
    padding: 0 !important;
    margin: 0 !important;
}

/* Social Media Brand Colors */
.footer-social-link.linkedin {
    background: linear-gradient(135deg, #0077b5 0%, #00a0dc 100%);
}

.footer-social-link.twitter {
    background: linear-gradient(135deg, #1DA1F2 0%, #0d8bd9 100%);
}

.footer-social-link.youtube {
    background: linear-gradient(135deg, #FF0000 0%, #cc0000 100%);
}

.footer-social-link.facebook {
    background: linear-gradient(135deg, #1877f2 0%, #0d65d9 100%);
}

.footer-social-link.instagram {
    background: linear-gradient(135deg, #f58529 0%, #dd2a7b 50%, #8134af 100%);
}

.footer-social-link:hover {
    background: rgba(255, 215, 0, 0.3) !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    border-color: rgba(255, 215, 0, 0.7);
    transform: none !important;
}

.footer-social-link svg {
    width: 20px !important;
    height: 20px !important;
    transition: none !important;
    transform: none !important;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -10px !important;
    margin-left: -10px !important;
    pointer-events: none;
}

.footer-social-link:hover svg,
.footer-social-link:active svg,
.footer-social-link:focus svg {
    transform: none !important;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -10px !important;
    margin-left: -10px !important;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* ===== EXTRA SMALL DEVICES (Portrait phones, 320px-575px) ===== */
@media (max-width: 575.98px) {
    .logo-img {
        height: 35px;
    }
    
    .company-name {
        font-size: 0.85rem;
        max-width: 250px;
    }
    
    .tagline {
        font-size: 0.6rem;
    }
    
    .nav-link {
        font-size: 0.9rem;
        padding: 0.6rem 1rem !important;
    }
    
    .modern-footer {
        padding-top: 1.5rem;
    }
    
    .modern-footer .col-lg-3,
    .modern-footer .col-lg-4,
    .modern-footer .col-lg-2,
    .modern-footer .col-md-6 {
        margin-bottom: 2rem;
    }
    
    .modern-footer h5 {
        font-size: 1rem;
    }
    
    .modern-footer .small {
        font-size: 0.85rem !important;
    }
    
    .footer-social-link {
        width: 36px;
        height: 36px;
    }
    
    .footer-social-link svg {
        width: 18px;
        height: 18px;
    }
}

/* ===== SMALL DEVICES (Landscape phones, 576px-767px) ===== */
@media (min-width: 576px) and (max-width: 767.98px) {
    .logo-img {
        height: 40px;
    }
    
    .company-name {
        font-size: 0.95rem;
        max-width: 310px;
    }
    
    .tagline {
        font-size: 0.65rem;
    }
    
    .nav-link {
        font-size: 0.92rem;
    }
    
    .modern-footer .col-md-6 {
        margin-bottom: 2rem;
    }
}

/* ===== MOBILE DEVICES (up to 767px) ===== */
@media (max-width: 767.98px) {
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, rgba(30, 60, 114, 0.98) 0%, rgba(42, 82, 152, 0.98) 100%);
        padding: 1rem;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        z-index: 1029;
    }
    
    .navbar-nav {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-item {
        width: 100%;
    }
    
    .nav-link {
        display: block;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mega-services-menu {
        position: static;
        display: none;
        width: 100%;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
        background: rgba(255, 255, 255, 0.95);
    }
    
    .services-mega.active .mega-services-menu,
    .language-mega.active .mega-services-menu {
        display: block;
    }
    
    .header-control-bar {
        width: 100%;
        flex-direction: column;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .header-control-bar > * {
        width: 100%;
    }
    
    .auth-controls {
        width: 100%;
    }
    
    .auth-controls .btn {
        width: 100%;
    }
    
    .modern-footer .text-md-start,
    .modern-footer .text-md-end {
        text-align: center !important;
    }
    
    .modern-footer .col-md-6 {
        padding-right: 15px !important;
    }
}

/* ===== MEDIUM DEVICES (Tablets, 768px-991px) ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .logo-img {
        height: 48px;
    }
    
    .company-name {
        font-size: 1.05rem;
        max-width: 350px;
    }
    
    .tagline {
        font-size: 0.72rem;
    }
    
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, rgba(30, 60, 114, 0.98) 0%, rgba(42, 82, 152, 0.98) 100%);
        padding: 1rem;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
    
    .navbar-nav {
        flex-direction: column;
    }
    
    .nav-link {
        font-size: 0.95rem;
    }
    
    .mega-services-menu {
        position: static;
        display: none;
        margin-top: 0.5rem;
    }
    
    .services-mega:hover .mega-services-menu,
    .language-mega:hover .mega-services-menu {
        display: block;
    }
    
    .header-control-bar {
        flex-direction: row;
        justify-content: flex-end;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .modern-footer {
        padding-top: 2.5rem;
    }
}

/* ===== LARGE DEVICES (Desktops, 992px-1199px) ===== */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .logo-img {
        height: 50px;
    }
    
    .company-name {
        font-size: 1.1rem;
        max-width: 410px;
    }
    
    .tagline {
        font-size: 0.75rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.93rem;
    }
    
    .navbar-nav {
        flex-direction: row;
        gap: 0.35rem;
    }
    
    .mega-services-menu {
        position: absolute;
        min-width: 260px;
    }
    
    .header-control-bar {
        flex-direction: row;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }
    
    .modern-footer {
        padding-top: var(--footer-padding-desktop);
    }
}

/* ===== EXTRA LARGE DEVICES (Large desktops, 1200px-1399px) ===== */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .logo-img {
        height: 52px;
    }
    
    .company-name {
        font-size: 1.15rem;
        max-width: 450px;
    }
    
    .tagline {
        font-size: 0.78rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.9rem !important;
        font-size: 0.95rem;
    }
    
    .navbar-nav {
        gap: 0.5rem;
    }
    
    .mega-services-menu {
        min-width: 280px;
    }
}

/* ===== XXL DEVICES (Extra large desktops, 1400px-1919px) ===== */
@media (min-width: 1400px) and (max-width: 1919.98px) {
    .logo-img {
        height: 55px;
    }
    
    .company-name {
        font-size: 1.2rem;
        max-width: 490px;
    }
    
    .tagline {
        font-size: 0.8rem;
    }
    
    .nav-link {
        padding: 0.55rem 1rem !important;
        font-size: 0.98rem;
    }
    
    .navbar-nav {
        gap: 0.6rem;
    }
    
    .mega-services-menu {
        min-width: 300px;
    }
    
    .modern-footer {
        padding-top: 3.5rem;
    }
}

/* ===== ULTRA-WIDE/PROJECTOR (1920px+) ===== */
@media (min-width: 1920px) {
    .logo-img {
        height: 60px;
    }
    
    .company-name {
        font-size: 1.3rem;
        max-width: 550px;
    }
    
    .tagline {
        font-size: 0.85rem;
    }
    
    .nav-link {
        padding: 0.6rem 1.2rem !important;
        font-size: 1rem;
    }
    
    .navbar-nav {
        gap: 0.75rem;
    }
    
    .mega-services-menu {
        min-width: 320px;
    }
    
    .modern-footer {
        padding-top: 4rem;
    }
    
    .modern-footer h5 {
        font-size: 1.25rem;
    }
    
    .modern-footer .small {
        font-size: 0.95rem !important;
    }
    
    .footer-social-link {
        width: 45px;
        height: 45px;
    }
    
    .footer-social-link svg {
        width: 22px;
        height: 22px;
    }
}

/* ===== 4K DISPLAYS (2560px+) ===== */
@media (min-width: 2560px) {
    .container {
        max-width: 2000px;
    }
    
    .logo-img {
        height: 70px;
    }
    
    .company-name {
        font-size: 1.5rem;
        max-width: 630px;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .nav-link {
        padding: 0.7rem 1.4rem !important;
        font-size: 1.1rem;
    }
    
    .navbar-nav {
        gap: 1rem;
    }
    
    .mega-services-menu {
        min-width: 360px;
    }
    
    .mega-sub-link {
        font-size: 1rem;
        padding: 0.8rem 1.2rem;
    }
    
    .modern-footer {
        padding-top: 5rem;
    }
    
    .modern-footer h5 {
        font-size: 1.4rem;
    }
    
    .modern-footer ul li {
        margin-bottom: 1rem;
    }
    
    .modern-footer .small {
        font-size: 1rem !important;
    }
    
    .footer-social-link {
        width: 50px;
        height: 50px;
    }
    
    .footer-social-link svg {
        width: 25px;
        height: 25px;
    }
}

/* ===== LANDSCAPE ORIENTATION FIXES ===== */
@media (max-width: 991.98px) and (orientation: landscape) {
    .navbar-collapse {
        max-height: calc(100vh - 60px);
    }
    
    .logo-img {
        height: 35px;
    }
    
    .company-name {
        font-size: 0.9rem;
    }
    
    .tagline {
        font-size: 0.65rem;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .modern-header,
    .navbar,
    .navbar-toggler,
    .header-control-bar,
    .footer-social-links,
    .mega-services-menu {
        display: none !important;
    }
    
    .modern-footer {
        background: white;
        color: black;
        padding: 1rem;
        border-top: 2px solid #000;
    }
    
    .modern-footer a {
        color: black !important;
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    .nav-link,
    .mega-sub-link,
    .footer-social-link,
    .navbar-toggler,
    * {
        transition: none !important;
        animation: none !important;
    }
}

@media (prefers-contrast: high) {
    .nav-link:hover,
    .nav-link.active {
        background-color: rgba(255, 255, 255, 0.3);
        border: 2px solid #FFD700;
    }
    
    .footer-social-link:hover {
        border: 2px solid #FFD700;
    }
}

/* ===== SMOOTH SCROLLBAR FOR NAVBAR COLLAPSE ===== */
.navbar-collapse {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.navbar-collapse::-webkit-scrollbar {
    width: 6px;
}

.navbar-collapse::-webkit-scrollbar-track {
    background: transparent;
}

.navbar-collapse::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.navbar-collapse::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ===== MOBILE MENU TOGGLE INTERACTION ===== */
@media (max-width: 991.98px) {
    .services-mega .nav-link::after,
    .language-mega .nav-link::after {
        content: '\f107';
        font-family: 'Font Awesome 5 Free';
        font-weight: 900;
        margin-left: 0.5rem;
        transition: transform 0.3s ease;
    }
    
    .services-mega.active .nav-link::after,
    .language-mega.active .nav-link::after {
        transform: rotate(180deg);
    }
}

/* ===== FOOTER RESPONSIVE GRID ENHANCEMENTS ===== */
@media (min-width: 1400px) {
    .modern-footer .row {
        align-items: flex-start;
    }
    
    .modern-footer .col-lg-3,
    .modern-footer .col-lg-4,
    .modern-footer .col-lg-2 {
        padding-right: 2rem;
    }
}

/* ===== FIX FOR OVERLAPPING CONTENT ===== */
body {
    padding-top: 0;
    overflow-x: hidden;
}

main {
    min-height: calc(100vh - var(--header-height-mobile) - 400px);
}

@media (min-width: 768px) {
    main {
        min-height: calc(100vh - var(--header-height-tablet) - 450px);
    }
}

@media (min-width: 992px) {
    main {
        min-height: calc(100vh - var(--header-height-desktop) - 500px);
    }
}

/* ===== PREVENT HORIZONTAL SCROLL ===== */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

.container {
    overflow-x: hidden;
}

/* ===== FLOATING BUTTONS RESPONSIVE FIXES ===== */
@media (max-width: 767.98px) {
    .quick-help-float,
    .donation-float,
    .whatsapp-float,
    .email-help-float {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .quick-help-tooltip,
    .donation-tooltip {
        font-size: 0.7rem;
    }
}

@media (min-width: 1920px) {
    .quick-help-float,
    .donation-float,
    .whatsapp-float,
    .email-help-float {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }
}
