/* =============================================
   HEADER
   ============================================= */
.main-header {
    background: #ffffff;
    font-family: 'Inter', sans-serif;
    border-bottom: 1px solid #ececec;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.main-header .header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 28px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 0;
}

/* Logo */
.main-header .logo { flex-shrink: 0; margin-right: 36px; }
.main-header .logo img { height: 36px; display: block; }
.main-header .logo a { text-decoration: none; display: flex; align-items: center; }

/* Nav - centered */
.main-header .nav-menu {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

/* Hide sidebar label on desktop */
.main-header .nav-sidebar-head { display: none; }

.main-header .nav-menu > ul {
    display: flex;
    list-style: none;
    gap: 0;
    margin: 0;
    padding: 0;
    align-items: center;
    height: 64px;
}

.main-header .nav-menu > ul > li {
    height: 100%;
    display: flex;
    align-items: center;
}

/* Hide icons on desktop - shown only in mobile sidebar */
.main-header .nav-link .nav-icon { display: none; }

.main-header .nav-link {
    color: #2c2c2c;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 15px;
    height: 100%;
    border-bottom: 2.5px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
    letter-spacing: 0.1px;
}

.main-header .nav-link:hover,
.main-header .nav-link.nav-current {
    color: #87b942;
    border-bottom-color: #87b942;
    background: transparent;
}

/* Arrow */
.main-header .arrow::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4.5px solid #aaa;
    margin-left: 3px;
    transition: transform 0.22s ease, border-top-color 0.2s;
    margin-top: 1px;
}

/* WhatsApp CTA */
.main-header .nav-cta-item {
    display: flex;
    align-items: center;
    height: 100%;
    margin-left: 8px;
}

.main-header .nav-cta-btn {
    background: #25d366;
    color: #fff;
    padding: 8px 18px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 2px 10px rgba(37,211,102,0.3);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.main-header .nav-cta-btn:hover {
    background: #1ebe5d;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37,211,102,0.38);
}

/* Auth buttons */
.main-header .header-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 20px;
}

.main-header .auth-btn {
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 50px;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
    display: inline-block;
    white-space: nowrap;
}

.main-header .auth-signin {
    color: #444;
    border: 1.5px solid #d4d4d4;
    background: transparent;
}

.main-header .auth-signin:hover {
    border-color: #87b942;
    color: #87b942;
    background: #f8fdf0;
}

.main-header .auth-signup {
    background: #87b942;
    color: #fff;
    border: 1.5px solid #87b942;
    box-shadow: 0 2px 10px rgba(135,185,66,0.28);
}

.main-header .auth-signup:hover {
    background: #74a336;
    border-color: #74a336;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(135,185,66,0.38);
}

.main-header .auth-logout {
    background: transparent;
    color: #e53935;
    border: 1.5px solid #e53935;
    cursor: pointer;
}

.main-header .auth-logout:hover { background: #e53935; color: #fff; }

/* Nav overlay */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1050;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.nav-overlay.active { display: block; }

.main-header .nav-auth-mobile { display: none; }

/* Hamburger */
.main-header .mobile-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 1200;
    position: relative;
    border-radius: 8px;
    transition: background 0.2s;
}

.main-header .mobile-hamburger:hover { background: #f4f4f4; }

.main-header .mobile-hamburger span {
    width: 22px;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
    display: block;
}

.main-header .mobile-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.main-header .mobile-hamburger.open span:nth-child(2) { opacity: 0; }
.main-header .mobile-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* =============================================
   DESKTOP DROPDOWN
   ============================================= */
.main-header .has-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.main-header .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 210px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    border-radius: 12px;
    list-style: none;
    margin: 0;
    padding: 6px 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    transform: translateY(8px);
    z-index: 1100;
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
}

.main-header .dropdown-menu li { margin: 0; padding: 0; }

@media (min-width: 1025px) {
    .main-header .has-dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .main-header .has-dropdown:hover > .nav-link .arrow::after {
        transform: rotate(180deg);
        border-top-color: #87b942;
    }

    .main-header .has-dropdown:hover > .nav-link {
        color: #87b942;
        border-bottom-color: #87b942;
    }
}

/* Account dropdown - click via .open */
.main-header .account-wrapper.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.main-header .account-wrapper.open .arrow::after { transform: rotate(180deg); }

/* Dropdown links */
.main-header .dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 18px;
    color: #333;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.main-header .dropdown-menu li a .sub-icon {
    color: #87b942;
    font-size: 12px;
    width: 15px;
    text-align: center;
    flex-shrink: 0;
}

.main-header .dropdown-menu li a:hover {
    background: #f4fbea;
    color: #5a8a20;
}

/* =============================================
   MOBILE (<=1024px)
   ============================================= */
@media (max-width: 1024px) {

    .main-header .header-container {
        padding: 0 16px;
        gap: 0;
    }

    .main-header .logo {
        flex: 1;
        margin-right: 0;
    }

    .main-header .header-auth { margin-left: 10px; }
    .main-header .mobile-hamburger { display: flex; margin-left: 6px; }

    .main-header .header-right { display: none; }

    /* Sidebar panel */
    .main-header .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        height: 100vh;
        background: #fff;
        flex-direction: column;
        flex: none;
        justify-content: flex-start;
        padding: 0;
        z-index: 1100;
        box-shadow: 8px 0 40px rgba(0,0,0,0.15);
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
        display: flex;
    }

    .main-header .nav-menu.active { transform: translateX(0); }

    /* Sidebar top bar: logo + close */
    .main-header .nav-sidebar-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 18px 16px 16px;
        border-bottom: 1px solid #f0f0f0;
        flex-shrink: 0;
    }

    .main-header .nav-sidebar-logo img {
        height: 30px;
        display: block;
    }

    /* Nav list */
    .main-header .nav-menu > ul {
        flex-direction: column;
        gap: 2px;
        padding: 10px 12px;
        margin: 0;
        height: auto;
        background: transparent;
        align-items: stretch;
    }

    .main-header .nav-menu > ul > li {
        height: auto;
        display: flex;
        flex-direction: column;
        border-bottom: none;
        width: 100%;
    }

    .main-header .nav-link {
        padding: 11px 12px;
        font-size: 14px;
        font-weight: 500;
        color: #2c2c2c;
        gap: 10px;
        border-radius: 10px;
        height: auto;
        border-bottom: none;
        border-bottom-color: transparent;
        align-items: center;
        align-self: stretch;
        justify-content: flex-start;
        width: 100%;
        text-align: left;
        transition: background 0.15s, color 0.15s;
    }

    .main-header .nav-icon-wrap {
        width: 30px;
        height: 30px;
        min-width: 30px;
        border-radius: 8px;
        background: #eef7e0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        transition: background 0.15s;
    }

    .main-header .nav-link .nav-icon {
        display: inline-block;
        font-size: 13px;
        color: #87b942;
        transition: color 0.15s;
    }

    .main-header .nav-link span:not(.arrow):not(.nav-icon-wrap) { flex: 1; }
    .main-header .nav-link .arrow { margin-left: auto; flex-shrink: 0; }

    .main-header .nav-link:hover,
    .main-header .nav-link.nav-current,
    .main-header .has-dropdown.active > .nav-link {
        background: #eef7e0;
        color: #2d6a04;
        font-weight: 600;
    }

    .main-header .nav-link:hover .nav-icon-wrap,
    .main-header .nav-link.nav-current .nav-icon-wrap,
    .main-header .has-dropdown.active > .nav-link .nav-icon-wrap {
        background: #d4edaa;
    }

    .main-header .has-dropdown.active > .nav-link .arrow::after {
        transform: rotate(180deg);
        border-top-color: #87b942;
    }

    .main-header .has-dropdown {
        height: auto;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    /* Sub-dropdown */
    .main-header .nav-menu .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        display: none;
        background: transparent;
        box-shadow: none;
        transform: none;
        padding: 2px 0 4px 52px;
        border: none;
        border-radius: 0;
        min-width: 100%;
        gap: 0;
    }

    .main-header .nav-menu .has-dropdown.active .dropdown-menu { display: flex; }

    .main-header .nav-menu .dropdown-menu li a {
        color: #555;
        padding: 8px 10px;
        font-size: 13px;
        font-weight: 500;
        border-radius: 8px;
        gap: 8px;
        transition: background 0.12s, color 0.12s;
        display: flex;
        align-items: center;
    }

    .main-header .nav-menu .dropdown-menu li a::before {
        content: '';
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: #ccc;
        flex-shrink: 0;
        transition: background 0.15s;
    }

    .main-header .nav-menu .dropdown-menu li a:hover { background: #e8f5d0; color: #2d6a04; }
    .main-header .nav-menu .dropdown-menu li a:hover::before { background: #87b942; }

    .main-header .nav-menu .dropdown-menu li a .sub-icon { display: none; }

    /* Account dropdown stays absolute on mobile */
    .main-header .account-wrapper .dropdown-menu {
        position: absolute;
        display: none;
        opacity: 1;
        visibility: visible;
        right: 0;
        left: auto;
        min-width: 210px;
        z-index: 1300;
    }

    .main-header .account-wrapper.open .dropdown-menu { display: flex; }

    /* WhatsApp CTA in sidebar */
    .main-header .nav-cta-item {
        padding: 6px 12px 4px;
        border: none;
        margin-top: 6px;
        height: auto;
    }

    .main-header .nav-cta-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 13px 14px;
        font-size: 14px;
        font-weight: 700;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(37,211,102,0.3);
        transform: none;
        letter-spacing: 0.2px;
    }

    .main-header .account-trigger {
        border: none;
        background: transparent;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        padding: 0;
        justify-content: center;
        gap: 0;
        box-shadow: none;
    }

    .main-header .account-trigger:hover { background: transparent; box-shadow: none; }
    .main-header .account-trigger .account-avatar { width: 36px; height: 36px; font-size: 15px; }
    .main-header .account-trigger .account-text,
    .main-header .account-trigger .arrow { display: none; }

    .main-header .account-wrapper .dropdown-menu {
        right: 0;
        left: auto;
        min-width: 210px;
        z-index: 1300;
        border-radius: 14px;
    }

    .main-header .header-auth .auth-btn { display: none; }

    /* Auth section in sidebar */
    .main-header .nav-auth-mobile {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 16px 16px 28px;
        margin-top: auto;
        border-top: 1px solid #f0f0f0;
    }

    .main-header .mob-user-info {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        background: #f8fdf0;
        border-radius: 12px;
        margin-bottom: 4px;
    }

    .main-header .mob-user-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: linear-gradient(135deg, #87b942 0%, #4d7a1f 100%);
        color: #fff;
        font-size: 16px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        font-family: 'Inter', sans-serif;
    }

    .main-header .mob-user-name {
        display: block;
        font-size: 14px;
        font-weight: 700;
        color: #111;
    }

    .main-header .mob-user-email {
        display: block;
        font-size: 11.5px;
        color: #888;
        margin-top: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    .main-header .mob-action-row {
        display: flex;
        gap: 8px;
        width: 100%;
    }

    .main-header .mob-action-row .mob-auth-btn,
    .main-header .mob-action-row form { flex: 1; }

    .main-header .mob-auth-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-align: center;
        padding: 13px 12px;
        font-size: 13.5px;
        font-weight: 600;
        border-radius: 12px;
        width: 100%;
        text-decoration: none;
        cursor: pointer;
        border: none;
        font-family: 'Inter', sans-serif;
        transition: background 0.2s, color 0.2s, opacity 0.2s;
    }

    .main-header .mob-btn-signup {
        background: #87b942;
        color: #fff;
        box-shadow: 0 3px 10px rgba(135,185,66,0.3);
    }

    .main-header .mob-btn-signup:hover { background: #74a336; }

    .main-header .mob-btn-signin {
        background: transparent;
        color: #333;
        border: 1.5px solid #ddd;
    }

    .main-header .mob-btn-signin:hover { border-color: #87b942; color: #87b942; background: #f8fdf0; }

    .main-header .mob-btn-admin {
        background: #f0f4ff;
        color: #3d5acd;
        border: 1.5px solid #d0d8ff;
        white-space: nowrap;
    }

    .main-header .mob-btn-admin:hover { background: #e0e8ff; }

    .main-header .mob-btn-logout {
        background: transparent;
        color: #cc3333;
        border: 1.5px solid #f0c0c0;
    }

    .main-header .mob-btn-logout:hover { background: #fff5f5; border-color: #cc3333; }
}

/* =============================================
   ACCOUNT DROPDOWN
   ============================================= */
.main-header .account-wrapper { position: relative; }

.main-header .account-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid #e4e4e4;
    color: #222;
    font-size: 14px;
    font-weight: 600;
    padding: 5px 13px 5px 5px;
    border-radius: 50px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.main-header .account-trigger:hover {
    border-color: #87b942;
    background: #f9fef2;
    box-shadow: 0 2px 10px rgba(135,185,66,0.18);
    color: #222;
}

.main-header .account-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #87b942 0%, #4d7a1f 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.main-header .account-avatar-dp {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.main-header .account-avatar-initial { line-height: 1; }

.main-header .account-text {
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

.main-header .account-trigger .arrow::after { border-top-color: #999; }
.main-header .account-wrapper.open .arrow::after {
    border-top-color: #87b942;
    transform: rotate(180deg);
}

.main-header .account-wrapper .dropdown-menu {
    right: 0;
    left: auto;
    min-width: 230px;
    border-radius: 14px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.13);
    padding: 7px 0 9px;
    transform: translateY(8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.main-header .account-wrapper.open .dropdown-menu { transform: translateY(0); }

/* Dropdown header - avatar + name */
.main-header .account-menu-header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 18px 12px;
    pointer-events: none;
}

.main-header .account-menu-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #87b942 0%, #4d7a1f 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.main-header .account-menu-dp {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.main-header .account-menu-initial { line-height: 1; }

.main-header .account-menu-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.main-header .account-menu-name {
    font-size: 14px;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-header .account-menu-email {
    font-size: 11.5px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-header .account-menu-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 5px 0;
    padding: 0;
}

.main-header .account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    color: #333;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.main-header .account-menu-item:hover { background: #f5fbe8; color: #5a8a20; }

.main-header .account-menu-item svg { flex-shrink: 0; opacity: 0.55; transition: opacity 0.15s; }
.main-header .account-menu-item:hover svg { opacity: 1; }

.main-header .account-menu-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 9px 18px;
    background: none;
    border: none;
    font-size: 13.5px;
    font-weight: 500;
    color: #e53935;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.main-header .account-menu-logout svg { flex-shrink: 0; opacity: 0.65; }
.main-header .account-menu-logout:hover { background: #fff5f5; }

/* Very small phones */
@media (max-width: 360px) { .main-header .nav-menu { width: 100%; } }

/* Tight desktop */
@media (min-width: 1025px) and (max-width: 1280px) {
    .main-header .header-container { padding: 0 20px; }
    .main-header .logo { margin-right: 24px; }
    .main-header .nav-link { font-size: 13.5px; padding: 0 11px; }
    .main-header .nav-cta-btn { padding: 7px 14px; font-size: 13px; }
    .main-header .auth-btn { padding: 7px 16px; font-size: 13px; }
    .main-header .header-auth { margin-left: 14px; }
}
