/**
 * APMFI Theme – Utilities & Animations
 *
 * @package APMFI_Theme
 */

/* ── Utility Helpers ── */
.text-primary-custom { color: var(--color-primary) !important; }
.text-secondary-custom { color: var(--color-secondary) !important; }
.bg-primary-custom { background-color: var(--color-primary) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-2xl { border-radius: 16px !important; }
.rounded-3xl { border-radius: 20px !important; }
.shadow-card { box-shadow: var(--shadow-md) !important; }
.overflow-hidden-x { overflow-x: hidden; }

.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }
.font-auto{font-size:clamp(1rem, calc(1vw + 0.6rem), 1rem);}

.text-truncate-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}
.text-truncate-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}

.ratio-16x9 { aspect-ratio: 16/9; }
.ratio-4x3  { aspect-ratio: 4/3; }
.ratio-1x1  { aspect-ratio: 1/1; }
.ratio-16x9 > *, .ratio-4x3 > *, .ratio-1x1 > * { width: 100%; height: 100%; object-fit: cover; }

.gap-xs  { gap: 4px;  }
.gap-sm  { gap: 8px;  }
.gap-md  { gap: 16px; }
.gap-lg  { gap: 24px; }

.hover-lift { transition: transform .25s ease, box-shadow .25s ease; }
.hover-lift:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,.12); }

/* ── Animations ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes countUp {
    from { opacity: 0; transform: scale(.8); }
    to   { opacity: 1; transform: scale(1); }
}
.animate-fade-up    { animation: fadeInUp  .6s ease forwards; }
.animate-fade-left  { animation: fadeInLeft .6s ease forwards; }
.animate-delay-1    { animation-delay: .1s; }
.animate-delay-2    { animation-delay: .2s; }
.animate-delay-3    { animation-delay: .3s; }
.animate-delay-4    { animation-delay: .4s; }

/* ── Language Switcher ── */
.lang-switcher {
    position: relative;
    display: flex;
    align-items: center;
}
.lang-switcher-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1.5px solid rgba(184,0,15,.2);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: .8rem;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    white-space: nowrap;
}
.lang-switcher-btn:hover,
.lang-switcher-btn.active {
    border-color: var(--color-primary);
    background: rgba(184,0,15,.05);
}
.lang-flag  { font-size: .95rem; line-height: 1; }
.lang-code { font-size: .75rem; font-weight: 700; color: var(--color-primary); }
.lang-caret { font-size: .6rem; color: #888; transition: transform .2s; }
.lang-switcher-btn[aria-expanded="true"] .lang-caret { transform: rotate(180deg); }

.lang-switcher-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1.5px solid #eee;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,.12);
    min-width: 160px;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.lang-switcher.is-open .lang-switcher-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}
.lang-switcher-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: .85rem;
    color: #333 !important;
    text-decoration: none;
    transition: background .15s;
    cursor: pointer;
}
.lang-switcher-item:hover { background: rgba(184,0,15,.05); color: var(--color-primary); }
.lang-switcher-item.active { background: rgba(184,0,15,.07); color: var(--color-primary) !important; font-weight: 600; }

/* Topbar language switcher variant */
.topbar-lang-switcher .lang-switcher-btn { border-color: rgba(255,255,255,.35); color: rgba(255,255,255,.9); background: rgba(255,255,255,.08); padding: 4px 10px; font-size: .75rem; }
.topbar-lang-switcher .lang-switcher-btn:hover,
.topbar-lang-switcher .lang-switcher-btn[aria-expanded="true"] { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.7); color: #fff; }
.topbar-lang-switcher .lang-code { color: #fff; }
.topbar-lang-switcher .lang-caret { color: rgba(255,255,255,.6); }
.topbar-lang-switcher .lang-switcher-menu { top: calc(100% + 8px); right: 0; min-width: 150px; }

.lang-switcher-mobile .lang-switcher-btn { padding: 4px 8px; font-size: .72rem; border-color: rgba(184,0,15,.2); background: rgba(184,0,15,.06); }
.lang-switcher-mobile .lang-switcher-menu { right: 0; left: auto; top: calc(100% + 6px); }

/* ── Mobile Header Quick Actions ── */
.btn-mobile-action {
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(184,0,15,.08);
    color: var(--color-primary);
    border-radius: 50%;
    font-size: .9rem;
    transition: background .2s;
}
.btn-mobile-action:hover { background: rgba(184,0,15,.15); color: var(--color-primary); }

.btn-mobile-apply {
    display: inline-flex;
    align-items: center;
    background: var(--color-primary);
    color: #fff !important;
    font-size: .8rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    transition: background .2s;
}
.btn-mobile-apply:hover { background: var(--color-primary-dark); color: #fff; }
.custom-logo-link {
    width: 230px;
}
/* Add this CSS instead of JavaScript for hover */
@media (min-width: 992px) {
    /* Show dropdown on hover */
    .navbar-nav .nav-item.dropdown:hover .dropdown-menu,
    .navbar-nav .nav-item.dropdown .dropdown-menu:hover {
        display: block !important;
        opacity: 1;
        visibility: visible;
    }
    
    /* Smooth transition */
    .navbar-nav .dropdown-menu {
        display: block !important;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }
    
    .navbar-nav .nav-item.dropdown:hover .dropdown-menu,
    .navbar-nav .nav-item.dropdown .dropdown-menu:hover {
        opacity: 1;
        visibility: visible;
    }
    
    /* Add delay for closing (keep open when moving to child) */
    .navbar-nav .nav-item.dropdown .dropdown-menu {
        transition-delay: 0.05s;
    }
    
    /* Remove arrow if needed */
    .navbar-nav .nav-item.dropdown > a::after {
        display: inline-block;
        margin-left: 0.255em;
        vertical-align: 0.255em;
        content: "";
        border-top: 0.3em solid;
        border-right: 0.3em solid transparent;
        border-bottom: 0;
        border-left: 0.3em solid transparent;
    }
    
}
/* ── Responsive ── */
@media (min-width: 1200px){
    .navbar>.container,
    .site-topbar>.container
    {max-width: 1280px;}
    .custom-logo-link {
        width: auto;
        max-width: 280px;
    }
}
@media (max-width: 991px) {
    :root {
        --header-height: 65px;
        --section-pad: 60px 0;
    }
    .navbar-collapse {
        background: #fff;
        padding: 12px 16px;
        border-radius: var(--radius-md);
        box-shadow: 0 8px 24px rgba(0,0,0,.08);
        margin-top: 10px;
        border-top: 2px solid var(--color-primary);
    }
    
    /* Mobile nav items */
    .navbar-collapse .navbar-nav {
        gap: 2px !important;
    }
    .navbar-collapse .nav-item {
        border-bottom: 1px solid rgba(0,0,0,.06);
    }
    .navbar-collapse .nav-item:last-child {
        border-bottom: none;
    }
    .navbar-collapse .nav-link {
        padding: 11px 12px !important;
        font-size: .92rem !important;
        font-weight: 600 !important;
        color: #1a1a1a !important;
        border-radius: var(--radius-sm);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .navbar-collapse .nav-link:hover,
    .navbar-collapse .nav-link.active {
        color: var(--color-primary) !important;
        background: rgba(184,0,15,.05);
    }
    .navbar-collapse .nav-link::after {
        display: none !important; /* hide underline indicator on mobile */
    }
    /* Dropdown inside mobile */
    .navbar-collapse .dropdown-menu {
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        border-left: 3px solid var(--color-primary) !important;
        border-radius: 0 !important;
        padding: 4px 0 4px 8px !important;
        margin: 0 !important;
        background: rgba(184,0,15,.03) !important;
    }
    .navbar-collapse .dropdown-item {
        padding: 9px 14px !important;
        font-size: .87rem !important;
        border-radius: var(--radius-sm);
    }
    .about-badge-box,
    .about-img-badge { right: -8px; bottom: -16px; margin-top: 20px; display: inline-block; }
    .stat-item { border-right: none; border-bottom: 1px solid rgba(255,255,255,.12); }
    .branch-map-layout { flex-direction: column; }
    /* .branch-list-col   { max-height: 400px; } */
    .branch-map-canvas { height: 380px; }
    /* .branch-list-scroll { max-height: 280px; } */
    .hero-badge{ font-size: 0.46rem;}
    .hero-title { font-size: 0.9rem;margin-bottom: 5px; }
    .hero-subtitle { font-size: 0.7rem; }
    .hero-actions .btn {margin: 0;}
    .btn-hero-primary,.btn-hero-outline{font-size: .62rem; padding: 2px 6px;}
    .stat-number,.stat-icon { font-size: 0.9rem; }
    .stat-label{ font-size: 0.65rem; }
}

@media (max-width: 767px) {
    
    :root { --section-pad: 20px 0; }
    .loan-calculator-box { padding: 24px; }
    .page-hero { padding: 30px 20px; }
    .row>*{ padding-left: 8px; padding-right: 8px;margin-top: 10px;}
    .form-control, 
    .form-select, 
    input[type="text"], 
    input[type="email"], 
    input[type="password"], 
    textarea {
        font-size: 16px !important;
    }
    #backToTop{opacity:0;display: none;}
    .float-calc-wrap{bottom: 25px; right: 16px;}
    .promo-card-img-wrap,.is-featured { height: 150px !important; }
    .career-card{display: grid;}
    .career-meta span:first-child{border-radius: 10px}
    .float-calc-panel { width: calc(100vw - 32px);}
    .custom-logo-link {
        width: 230px;
    }
    
}

@media (max-width: 575px) {
    .stat-item { border-bottom: 1px solid rgba(255,255,255,.1); }
    .apmfi-contact-form-wrap { padding: 24px 18px; }
    .branch-map-col {height: 400px;}
    .annual-report-image{height:300px;}
    .footer-regulators{align-self: center;}
    .branch-list-controls{padding: 0;}
    .hero-slide-image{object-fit: fill;}
    .carousel-indicators{margin-bottom: 0;}
    .social-sm{width:100%;}
    .section-heading{margin-bottom: 30px;}
}

@media (max-width: 480px) {
    .custom-logo-link {
        width: 160px;
    }
    .hero-content{
        padding: 0.5rem 1rem;
    }
    .branch-map-col {height: 400px;}
}
