﻿/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
    --nav-height: 60px;
    --nav-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --hover-bg: #f3f4f6;
    --dropdown-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
    --border-color: #dee2e6;
    --mobile-overlay-width: 70%;
    --transition-speed: 0.2s;
}

/* ============================================
   BASE NAV STRUCTURE
   ============================================ */
nav {
    background: white;
    box-shadow: var(--nav-shadow);
}

.cma-nav-container {
    width: 100%;
    padding: 0 12px;
}

.nav-content {
    display: flex;
    align-items: center;
    height: var(--nav-height);
}

/* ============================================
   DESKTOP NAVIGATION SECTIONS
   ============================================ */
.right-nav {
    display: flex;
    align-items: center;
    width: 60%;
    height: 100%;
}

.left-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 40%;
    height: 100%;
    margin: auto 1%;
}

/* Navigation Links Container */
.cma-nav-links {
    display: flex;
    align-items: center;
    width: 60%;
    height: 100%;
    margin-right: 25px;
}

.cma-nav-items {
    display: flex;
    width: auto;
    height: 100%;
    gap:0;
}

.cma-nav-item {
    display: flex;
    align-items: center;
    width: auto;
    min-width:fit-content;
    height: 100%;
}

/* ============================================
   NAV LINKS - BASE STYLES
   ============================================ */
.cma-nav-link {
    display: flex;
    position: relative;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0 16px;
    text-decoration: none;
    color: #000;
    font-size: 16px;
    font-weight: 600;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

    .cma-nav-link.active {
        font-weight: 600;
    }

    .cma-nav-link .icon-link-arrow {
        margin: 0 6px;
    }

/* ============================================
   UNIFIED HOVER EFFECTS
   ============================================ */
.cma-nav-link,
.cma-dropdown-toggle,
.cma-icon-btn,
.registered-user > span {
    position: relative;
    cursor: pointer;
}

    /* Bottom indicator bar */
    .cma-nav-link::before,
    .cma-dropdown-toggle::before,
    .cma-icon-btn::before,
    .registered-user > span::before {
        content: "";
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 80%;
        height: 6px;
        border-radius: 15px;
        background-color: #9da4ae;
        opacity: 0;
        transition: opacity var(--transition-speed) ease;
        z-index: 1;
    }

    /* Hover states */
    .cma-nav-link:hover,
    .cma-dropdown-toggle:hover,
    .cma-icon-btn:hover,
    .registered-user > span:hover {
        background-color: var(--hover-bg);
        color: #000;
    }

        .cma-nav-link:hover::before,
        .cma-dropdown-toggle:hover::before,
        .cma-icon-btn:hover::before,
        .registered-user > span:hover::before {
            opacity: 1;
        }

/* ============================================
   DROPDOWN MENU - DESKTOP
   ============================================ */
.cma-dropdown {
    position: relative;
    height: 100%;
}

.cma-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 6px;
    padding: 0 16px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #000;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.chevron {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

/* Open state */
.cma-dropdown.open .chevron {
    transform: rotate(180deg);
}

.cma-dropdown.open .cma-dropdown-toggle {
    background-color: var(--cma-btn-main);
    color: var(--cma-text-light);
}

    .cma-dropdown.open .cma-dropdown-toggle::before {
        opacity: 1;
        background-color: #6ac583;
    }

/* Dropdown Menu Panel */
.cma-dropdown-menu {
    position: fixed;
    top: 97px;
    left: 0;
    width: 100vw;
    background: #fff;
    padding: 30px 4vw;
    box-shadow: var(--dropdown-shadow);
    border-top: 1px solid var(--border-color);
    display: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 9999;
}

.cma-dropdown.open .cma-dropdown-menu {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Dropdown Items */
.cma-dropdown-item {
    display: block;
    width: 18.5%;
    padding: 10px 20px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    color: #343a40;
    border-radius: 4px;
    transition: background 0.25s ease, color 0.25s ease;
}

    .cma-dropdown-item:hover {
        background-color: var(--hover-bg);
        text-decoration: underline;
        color: #343a40;
    }

.main-cma-dropdown-item {
    font-size: 18px;
    font-weight: 700;
    color: var(--cma-text-green);
}

    .main-cma-dropdown-item:hover {
        background: inherit;
        text-decoration: none;
        color: var(--cma-text-green);
    }



/* ============================================
   Dropdown if logged in 
   ============================================ */
.cma-dropdown-logout-btn {
    border:none;
    background-color:#fff;
    text-align:start;

}
    /* ============================================
   ICON BUTTONS
   ============================================ */
    .cma-icon-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        gap: 10px;
        padding: 0 16px;
        background: none;
        border: none;
        color: #374151;
        font-size: 1rem;
        font-weight: 700;
        font-family: inherit;
        transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    }

/* ============================================
   USER DROPDOWN
   ============================================ */
.visitor-wrapper {
    display: flex;
    align-items: center;
    height: 100%;
}

.registered-user {
    display: flex;
    align-items: center;
    height: 100%;
}

    .registered-user > span {
        display: flex;
        align-items: center;
        gap: 6px;
        height: 100%;
        padding: 0 16px;
        transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    }

    .registered-user .dropdown-menu {
        margin-top: 0;
    }

/* ============================================
   SEARCH OVERLAY
   ============================================ */
.cma-search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    padding-top: 80px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9999;
}

    .cma-search-overlay.active {
        display: block;
    }

.cma-search-box {
    position: relative;
    width: 100vw;
    height: 100vh;
    margin-top: 150px;
    padding: 10% 18%;
    background: #fff;
    border-radius: 5px;
}

.cma-search-close-btn {
    position: absolute;
    left: 17%;
    width: 2vw;
    height: 2vh;
    background: none;
    border: none;
    cursor: pointer;
}

    .cma-search-close-btn img {
        width: 100%;
        height: 100%;
    }

/* Search Input */
.cma-search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 5%;
}

.cma-input-group {
    position: relative;
    flex: 1;
}

.cma-input {
    width: 100%;
    padding: 6px 40px 6px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: transparent;
    font-size: var(--cma-form-placeholder);
    font-weight: 500;
    color: #444;
    outline: none;
}

.cma-input-group::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 1.8px;
    background-color: #0D121C;
    transition: width 0.3s ease, left 0.3s ease;
}

.cma-input-group:focus-within::after {
    width: 100%;
    left: 0;
}

.cma-input-icon {
    position: absolute;
    right: 5px;
    top: 45%;
    width: 2vw;
    height: 2vh;
    transform: translateY(-50%);
}

    .cma-input-icon img {
        width: 80%;
        height: 80%;
    }

.cma-clear-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
}

.cma-search-btn {
    padding: 9px 18px;
    border: none;
    border-radius: 5px;
    background: var(--cma-btn-main);
    color: var(--cma-text-light);
    font-size: var(--cma-btn-font-size);
    font-weight: 700;
    cursor: pointer;
}

    .cma-search-btn:hover {
        background-color: var(--cma-btn-main-hover);
    }

/* Search Tags */
.cma-tags-wrapper {
    margin-top: 5%;
}

.cma-tags-title {
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--cma-text-green);
}

.cma-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.cma-tag {
    padding: 2px 10px;
    text-decoration: none;
    background: var(--cma-btn-light-green);
    border: 1px solid var(--cma-btn-light-green-border);
    border-radius: 5px;
    color: var(--cma-text-green);
    cursor: pointer;
}

    .cma-tag:hover {
        color: var(--cma-text-green);
    }

/* ============================================
   MOBILE NAVIGATION (Hidden on Desktop)
   ============================================ */
.mobile-nav {
    display: none;
}

.hamburger {
    display: none;
}

.mobile-overlay {
    display: none;
}

/* ============================================
   RESPONSIVE: TABLET (769px - 1023px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1023px) {
    .header-logo img {
        width: 85%;
    }

    .cma-nav-links {
        margin-right: 0;
        gap: 10px;
    }

    /* Search overlay adjustments */
    .cma-search-box {
        padding: 15%;
    }

    .cma-search-input-wrapper,
    .cma-tags-wrapper {
        margin-top: 10%;
    }

    .cma-search-close-btn {
        left: 15%;
        width: 2.5vw;
        height: 2vh;
    }

    .cma-input-icon {
        right: 10px;
        top: 50%;
        width: 3vw;
        height: 2vh;
    }

        .cma-input-icon img {
            width: 100%;
            height: 100%;
        }
}

/* ============================================
   RESPONSIVE: MOBILE (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Show mobile navigation */
    .mobile-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 98%;
    }

    /* Hide desktop navigation */
    .left-nav,
    .right-nav {
        display: none;
    }

    /* Mobile nav layout */
    .hamburger {
        order: 1;
    }

    .header-logo {
        order: 2;
    }

    /* Hamburger menu */
    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 35px;
        height: 30px;
        padding: 5px;
        cursor: pointer;
    }

        .hamburger span {
            width: 100%;
            height: 3px;
            background: #333;
            border-radius: 3px;
            transition: 0.3s ease;
        }

    /* Blur overlay behind mobile menu */
    .mobile-blur-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(6px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease;
        z-index: 998;
    }

        .mobile-blur-overlay.active {
            opacity: 1;
            visibility: visible;
        }

    /* Mobile overlay menu */
    .mobile-overlay {
        position: fixed;
        top: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: var(--mobile-overlay-width);
        height: 100vh;
        background-color: #fff;
        overflow-y: auto;
        transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
        z-index: 999;
        will-change: transform;
    }

        /* RTL (Right to Left) slide direction */
        .mobile-overlay.rtl {
            transform: translateX(100%);
        }

            .mobile-overlay.rtl.active {
                transform: translateX(0);
            }

        /* LTR (Left to Right) slide direction */
        .mobile-overlay.ltr {
            transform: translateX(-100%);
        }

            .mobile-overlay.ltr.active {
                transform: translateX(0);
            }

    /* Mobile nav header */
    .cma-nav-header {
        display: flex;
        justify-content: space-between;
        width: 100%;
        height: 7%;
        padding: 4% 2%;
        background-color: rgb(249, 250, 251);
    }

    .cma-logo-container {
        width: 75%;
    }

        .cma-logo-container img {
            width: 100%;
            height: 100%;
        }

    .cma-nav-close-btn {
        position: unset !important;
        align-self: center;
        margin: auto 2%;
    }

    /* Mobile nav controls (search, buttons) */
    .cma-nav-controls {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        width: 90%;
        gap: 15px;
        padding: 10px;
        background: transparent;
        border-bottom: 1px solid #e0e0e0;
    }

    .cma-search-icon img {
        width: 80%;
        height: 80%;
        object-fit: contain;
    }

    .cma-nav-btn {
        padding: 8px 12px;
        border: none;
        border-radius: 4px;
        background-color: var(--cma-btn-direction);
        color: var(--cma-text-dark);
        font-size: 16px;
        font-weight: 600;
        text-align: center;
        cursor: pointer;
    }

    /* Mobile nav items */
    .cma-mobile-nav-item {
        position: relative;
        width: 90%;
        border-bottom: 1px solid #d2d6db;
    }

    .cma-mobile-nav-subitem {
        border-bottom: none;
    }

    .cma-mobile-nav-item-link {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 22px 16px 15px;
        text-decoration: none;
        color: var(--cma-text-dark);
        font-size: 16px;
        cursor: pointer;
        transition: background var(--transition-speed);
    }



    .cma-main-mobile-dropdown {
        font-size: 18px !important;
        font-weight: 700;
        padding-top: 25px !important;
        color: var(--cma-text-green);
    }


    /* Mobile dropdown toggle */
    .cma-mobile-nav-dropdown-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 16px 22px 16px 15px;
        background: transparent;
        border: none;
        font-size: 16px;
        cursor: pointer;
        transition: background var(--transition-speed);
    }

    /* Mobile dropdown items */
    .cma-mobile-nav-dropdown-items {
        max-height: 0;
        overflow: hidden;
        background: #fff;
        transition: max-height 0.3s ease;
    }

    /* Expanded state */
    .cma-mobile-nav-item.expanded {
        border-bottom: none;
    }

        .cma-mobile-nav-item.expanded .cma-mobile-nav-dropdown-items {
            max-height: 500px;
            padding: 0 16px 0 16px;
        }

        .cma-mobile-nav-item.expanded .chevron {
            transform: rotate(180deg);
            transition: transform 0.3s ease;
        }

        .cma-mobile-nav-item.expanded .cma-mobile-nav-dropdown-toggle {
            position: relative;
            background-color: #E5E7EB;
            border-bottom: 1px solid #d2d6db;
            color: var(--cma-text-green);
        }

    /* RTL - Right border for expanded dropdown */
    .mobile-overlay.rtl .cma-mobile-nav-item.expanded .cma-mobile-nav-dropdown-toggle::before {
        content: "";
        position: absolute;
        right: 1px;
        height: 70%;
        width: 5px;
        background-color: #1B8354;
        border-radius: 999px;
    }

    /* LTR - Left border for expanded dropdown */
    .mobile-overlay.ltr .cma-mobile-nav-item.expanded .cma-mobile-nav-dropdown-toggle::before {
        content: "";
        position: absolute;
        left: 1px;
        height: 70%;
        width: 5px;
        background-color: #1B8354;
        border-radius: 999px;
    }

    /* Dropdown link styling */
    .cma-mobile-nav-dropdown-items .cma-mobile-nav-item-link {
        padding: 8px 20px 8px 40px;
        border-radius: 5px;
        font-size: 16px;
        background: transparent;
    }

        .cma-mobile-nav-dropdown-items .cma-mobile-nav-item-link:hover {
            background: var(--hover-bg);
            text-decoration: underline;
            color: #000;
        }

    .cma-main-mobile-dropdown:hover {
        color: var(--cma-text-green) !important;
        background: transparent !important;
        text-decoration: none !important;
    }



    .mobile-overlay .cma-nav-item a {
        font-size: 20px;
        font-weight: 700;
        color: #000;
    }
}

/* ============================================
   RESPONSIVE: MOBILE (376px - 767px)
   ============================================ */
@media (min-width: 376px) and (max-width: 767px) {
    .cma-search-box {
        padding: 30% 16%;
    }

    .cma-search-input-wrapper,
    .cma-tags-wrapper {
        margin-top: 15%;
    }

    .cma-search-close-btn {
        left: 16%;
        width: 3.3vw;
        height: 3vh;
    }

    .cma-input-icon {
        right: 10px;
        top: 50%;
        width: 4vw;
        height: 3vh;
    }

        .cma-input-icon img {
            width: 100%;
            height: 100%;
        }
}

/* ============================================
   RESPONSIVE: SMALL MOBILE (≤ 380px)
   ============================================ */
@media (max-width: 380px) {
    .header-logo {
        width: 65%;
    }

    .navbar-brand img {
        width: 90%;
    }

    .cma-search-box {
        padding: 20% 10%;
    }

    .cma-search-input-wrapper,
    .cma-tags-wrapper {
        margin-top: 15%;
    }

    .cma-search-close-btn {
        left: 10%;
        width: 3.3vw;
        height: 3vh;
    }

    .cma-input-icon {
        right: 10px;
        top: 50%;
        width: 4vw;
        height: 3vh;
    }

        .cma-input-icon img {
            width: 100%;
            height: 100%;
        }
}
