:root {
    --primary-blue: #004494;
    --secondary-blue: #004494;
    --light-blue: #e6f0fa;
    --white: #ffffff;
    --dark-text: #1a1a1a;
    --gray-text: #555555;
    --bg-light: #f8fbff;
    --transition-speed: 0.3s;
    --box-shadow: 0 10px 30px rgba(0, 86, 179, 0.1);
    --hover-shadow: 0 15px 40px rgba(0, 86, 179, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--dark-text);
    background-color: var(--bg-light);
    line-height: 1.6;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Language Toggle Defaults */
.lang-ml {
    display: none;
    /* Default to English */
}

body.ml-active .lang-en {
    display: none !important;
}

body.ml-active .lang-ml {
    display: unset;
    word-break: break-word;
    font-weight: normal !important;
    letter-spacing: normal !important;
}

/* Navbar */
header {
    background-color: var(--white);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-bar {
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 0.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.lang-switch button {
    background: transparent;
    border: 1px solid var(--white);
    color: var(--white);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all var(--transition-speed);
}

.lang-switch button:hover {
    background: var(--white);
    color: var(--primary-blue);
}

/* Container layout to space out the Logo side and the Navigation side */
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5%;
    background: #ffffff;
}

/* Logo wrapper link styling */
.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 15px;
    /* Spaces out the circular emblem and the text */
}

/* Fixes the circular image resolution/visibility issues */
.logo-img {
    height: 75px;
    /* Increases height so details are clear */
    width: 75px;
    /* Forces equal width to prevent stretching */
    object-fit: contain;
    display: block;
}

/* Typography arrangement for Bank Names */
.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo-text h1 {
    font-size: 24px;
    font-weight: 800;
    color: #1a73e8;
    /* Matches your crisp brand blue */
    margin: 0;
    line-height: 1.2;
    letter-spacing: 0.5px;
}

.logo-text p {
    font-size: 13px;
    color: #5f6368;
    /* Clean dark grey for secondary text */
    margin: 2px 0 0 0;
    line-height: 1.3;
    font-weight: 500;
}

/* Language toggle helpers (adjust based on your JS toggle mechanism) */
.logo-text .lang-ml {
    font-family: 'Gayathri', 'Manjari', sans-serif;
    /* Recommended clean Malayalam web fonts */
    font-size: 12px;
}

/* Container holding both the image and the text */
.logo-container {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 16px;
    /* Creates elegant spacing between emblem and text */
    padding: 5px 0;
}

/* Fixes the circular logo visibility and applies boldness */
.bank-logo-img {
    height: 105px;
    /* Increased significantly so the text inside the seal is actually readable */
    width: 105px;
    max-width: none;
    flex-shrink: 0;
    object-fit: contain;
    background: transparent;
    display: block;
    /* This filter makes the thin lines of the original logo appear bold and crisp! */
    filter: drop-shadow(0.5px 0.5px 0 rgba(0, 0, 0, 0.5)) drop-shadow(-0.5px -0.5px 0 rgba(0, 0, 0, 0.5)) contrast(1.2);
}

/* Branding Typography Layout */
.bank-branding-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Core Title styling */
.bank-title {
    font-size: 19px;
    font-weight: 800;
    color: #0066cc;
    /* Clean, bold professional blue matching your site header theme */
    margin: 0;
    line-height: 1.3;
    letter-spacing: 0.5px;
    font-family: sans-serif;
}

/* English and Malayalam Subtitle formatting */
.bank-subtitle {
    font-size: 13px;
    font-weight: 500;
    color: #4a4a4a;
    /* Smooth dark gray for crisp reading */
    margin: 3px 0 0 0;
    line-height: 1.2;
}

/* Optional styling tweak for clean rendering of the Malayalam font script */
.bank-subtitle.lang-ml {
    font-size: 12px;
    margin-top: 2px;
    font-family: sans-serif;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav ul li a {
    text-decoration: none;
    color: var(--dark-text);
    font-weight: 600;
    font-size: 1.05rem;
    transition: color var(--transition-speed);
    position: relative;
}

nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--primary-blue);
    transition: width var(--transition-speed);
}

nav ul li a:hover,
nav ul li a.active {
    color: var(--primary-blue);
}

nav ul li a:hover::after,
nav ul li a.active::after {
    width: 100%;
}

/* Hero Section */
.hero {
    height: 80vh;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(17, 120, 255, 0.4) 100%), url('../images/main-branch2.jpeg');
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 0 5%;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: rgba(0, 86, 179, 0.05);
    border-radius: 50%;
    top: -200px;
    right: -200px;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero h2 {
    font-size: 3.5rem;
    color: var(--white);
    margin-bottom: 1.5rem;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 1s ease-out;
}

.hero p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 1s ease-out 0.2s both;
}

.btn-primary {
    display: inline-block;
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 1rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all var(--transition-speed);
    box-shadow: 0 5px 15px rgba(0, 86, 179, 0.3);
    animation: fadeInUp 1s ease-out 0.4s both;
}

.btn-primary:hover {
    background-color: var(--secondary-blue);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 86, 179, 0.4);
}

/* Common Sections */
.section {
    padding: 5rem 5%;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
}

#about-section {
    position: relative;
    overflow: hidden;
}

#about-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background-image: url('../images/cscb lOGO.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.06;
    /* Elegant faded watermark */
    z-index: 0;
    pointer-events: none;
}

#about-section>* {
    position: relative;
    z-index: 1;
}

.section-title {
    text-align: center;
    color: var(--primary-blue);
    font-size: 2.5rem;
    margin-bottom: 3rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background-color: var(--primary-blue);
    margin: 10px auto 0;
    border-radius: 2px;
}

/* Cards (Services) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--white);
    padding: 2.5rem 2rem;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    transition: all var(--transition-speed);
    text-align: center;
    border-bottom: 5px solid transparent;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: var(--hover-shadow);
    border-bottom-color: var(--primary-blue);
}

.card-icon {
    font-size: 3rem;
    color: var(--primary-blue);
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--dark-text);
}

.card p {
    color: var(--gray-text);
}

/* Footer */
footer {
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 4rem 5% 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 10px;
}

.footer-col h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background: var(--light-blue);
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 0.8rem;
}

.footer-col a {
    color: var(--light-blue);
    text-decoration: none;
    transition: color var(--transition-speed);
}

.footer-col a:hover {
    color: var(--white);
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* History Section Expand Animation */
.history-text-container {
    position: relative;
    /* max-height removed because Read More button was removed */
}

.history-text-container .lang-en {
    font-family: 'Merienda', cursive !important;
    font-size: 1.15rem !important;
    line-height: 1.8;
    color: var(--dark-text);
    font-weight: 500;
    text-align: justify;
}

/* Removed expanded and after gradient styles as they are no longer needed */

.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
    margin-bottom: 2rem;
    color: var(--primary-blue);
    background: transparent;
    border: 2px solid var(--primary-blue);
    padding: 0.6rem 1.8rem;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--transition-speed);
}

.read-more-btn i {
    transition: transform 0.5s ease;
}

.read-more-btn.expanded i {
    transform: rotate(180deg);
}

.read-more-btn:hover {
    background: var(--primary-blue);
    color: var(--white);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 86, 179, 0.2);
}

/* Forms */
.contact-form {
    background: var(--white);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-control {
    width: 100%;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition-speed);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
    height: 250px;
    background-color: var(--light-blue);
    /* Placeholder */
    position: relative;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed);
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Team Section */
.team-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 0 5%;
}

.team-member {
    width: 260px;
    max-width: 100%;
    background: var(--white);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: var(--box-shadow);
    transition: transform var(--transition-speed);
}

.team-member:hover {
    transform: translateY(-5px);
}

.team-member .avatar {
    width: 120px;
    height: 120px;
    background: var(--light-blue);
    border-radius: 15px;
    margin: 0 auto 1rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.team-member .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.executive-member {
    width: 300px;
    padding: 2.5rem;
}

.executive-member .avatar {
    width: 200px;
    height: 200px;
}

.team-member h4 {
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.team-member p {
    font-size: 0.9rem;
    color: #666;
}

/* Image Carousel */
.carousel-container {
    overflow: hidden;
    width: 100%;
    padding: 1rem 0;
}

.carousel-track {
    display: flex;
    width: max-content;
    animation: scrollTrack 20s linear infinite;
}

@media (hover: hover) {
    .carousel-track:hover {
        animation-play-state: paused;
    }
}

.carousel-slide {
    text-decoration: none;
    color: inherit;
    width: calc((90vw - 4rem) / 3);
    height: 300px;
    margin-right: 2rem;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--white);
}

.carousel-slide img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background-color: var(--white);
    transition: transform 0.3s;
}

.carousel-slide:hover img {
    transform: scale(1.05);
}

.slide-caption {
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--primary-blue);
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes scrollTrack {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Gallery Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.modal-content {
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 1000px;
    position: relative;
    animation: fadeInUp 0.5s ease-out;
}

.close-modal {
    color: #fff;
    position: absolute;
    top: 15px;
    right: 35px;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 2001;
}

.close-modal:hover {
    color: #ccc;
    transform: scale(1.1);
}

.modal-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.modal-gallery img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s;
    cursor: zoom-in;
}

.modal-gallery img:hover {
    transform: scale(1.03);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--primary-blue);
    cursor: pointer;
    padding: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: row;
        flex-wrap: wrap;
        /* allow .main-nav to drop to the next row */
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        padding: 10px 5%;
        position: relative;
        /* for absolute positioning of main-nav */
    }

    .logo-container {
        flex: 1;
        min-width: 0;
        /* allows the container to shrink without breaking flex layout */
        max-width: 85%;
    }

    .mobile-menu-toggle {
        display: block;
        position: relative;
        z-index: 9999;
        padding: 15px;
        /* increase touch target size */
        flex-shrink: 0;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--white);
        box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        margin-top: 0;
        border-top: 1px solid #eee;
        padding-top: 15px;
        padding-bottom: 20px;
        z-index: 999;
    }

    .main-nav.active {
        display: block;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 1.2rem;
    }

    nav ul li a {
        font-size: 1.1rem;
        display: block;
        padding: 5px;
    }

    .hero h2 {
        font-size: 1.8rem;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }

    .bank-logo-img {
        height: 50px;
        width: 50px;
    }

    .bank-title {
        white-space: normal;
        font-size: 12px;
        text-align: left;
        line-height: 1.2;
    }

    .logo-container {
        flex-direction: row;
        text-align: left;
        gap: 10px;
        flex: 1;
    }

    .top-bar {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }

    .carousel-slide {
        width: 260px;
        height: 240px;
        margin-right: 1rem;
    }

    .carousel-slide img {
        height: 160px;
    }

    /* Fix services page inline styles for mobile */
    #deposits,
    #loans,
    #mss,
    #other-services {
        padding: 1.2rem !important;
    }

    #deposits h2,
    #loans h2,
    #mss h2,
    #other-services h2 {
        font-size: 1.15rem !important;
    }

    #deposits>div:nth-child(2),
    #loans>div:nth-child(2),
    #mss>div:nth-child(2),
    #other-services>div:nth-child(2) {
        gap: 0.5rem !important;
    }

    #deposits>div:nth-child(2)>div:first-child,
    #loans>div:nth-child(2)>div:first-child,
    #mss>div:nth-child(2)>div:first-child,
    #other-services>div:nth-child(2)>div:first-child {
        width: 45px !important;
        height: 45px !important;
        font-size: 1.3rem !important;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    /* Fullscreen Gallery Modal for Mobile */
    .modal-content {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .mySlides img {
        border-radius: 0 !important;
    }

    /* Center Footer on Mobile */
    .footer-col {
        text-align: center;
    }

    .footer-col h4::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-col div[style*="display: flex"] {
        justify-content: center;
    }
}

@media (max-width: 1200px) and (min-width: 769px) {
    .bank-title {
        font-size: 16px;
    }
}