/* WP Block Management — Leaseholder Portal */
:root {
    --wpbm-green:       #1a3a2e;
    --wpbm-green-light: #2d5a47;
    --wpbm-accent:      #c8a951;
}

/* ── Base wrap ───────────────────────────────────────────────────────────── */
.wpbm-portal-wrap {
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #2d3748;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Login ───────────────────────────────────────────────────────────────── */
.wpbm-login-box {
    max-width: 420px;
    margin: 60px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    overflow: hidden;
}
.wpbm-login-header {
    background: var(--wpbm-green);
    color: #fff;
    text-align: center;
    padding: 32px 24px;
}
.wpbm-login-header h2 { margin: 0 0 4px; font-size: 1.4rem; }
.wpbm-login-header p  { margin: 0; opacity: .8; font-size: .9rem; }
.wpbm-login-box form  { padding: 28px 28px 24px; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.wpbm-portal-header {
    background: var(--wpbm-green);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    z-index: 800;
}

.wpbm-portal-header__brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.wpbm-portal-header__right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.wpbm-portal-header__user {
    text-align: right;
    font-size: .85rem;
}

/* ── Hamburger button — hidden on desktop ────────────────────────────────── */
.wpbm-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}
.wpbm-hamburger__bar {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}

/* ── Portal body ─────────────────────────────────────────────────────────── */
.wpbm-portal-body {
    display: grid;
    grid-template-columns: 220px 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Sidebar nav ─────────────────────────────────────────────────────────── */
.wpbm-portal-nav {
    background: var(--wpbm-green);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
}
.wpbm-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: .9rem;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}
.wpbm-nav-item:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.wpbm-nav-active {
    background: rgba(255,255,255,.15) !important;
    color: #fff !important;
    font-weight: 600;
    border-left-color: var(--wpbm-accent);
}
.wpbm-nav-icon {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.wpbm-nav-logout {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: 12px;
}

/* ── Content area ────────────────────────────────────────────────────────── */
.wpbm-portal-content {
    padding: 28px;
    background: #f7f8fa;
    overflow-y: auto;
    min-width: 0;
    height: 100%;
    box-sizing: border-box;
}

/* ── Property switcher ───────────────────────────────────────────────────── */
.wpbm-property-switcher {
    background: #f0f4f0;
    border-bottom: 1px solid #d1d5db;
    padding: 10px 20px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin: -28px -28px 20px -28px;
}
.wpbm-property-switcher__label {
    font-size: .75rem;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
    margin-right: 4px;
}
.wpbm-property-switcher__item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 500;
    text-decoration: none;
    background: #fff;
    color: var(--wpbm-green);
    border: 1.5px solid #c5d4cc;
    transition: all .15s;
}
.wpbm-property-switcher__item--active {
    background: var(--wpbm-green);
    color: #fff;
    border-color: var(--wpbm-green);
    font-weight: 700;
}
.wpbm-property-switcher__joint {
    font-size: .65rem;
    opacity: .75;
    font-weight: 400;
}

/* ── Co-leaseholder notice ───────────────────────────────────────────────── */
.wpbm-co-notice {
    background: #eff6ff;
    border: 1.5px solid #93c5fd;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 18px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: .82rem;
    color: #1e40af;
}
.wpbm-co-notice__icon {
    font-size: 1rem;
    flex-shrink: 0;
}

/* ── Mobile nav overlay ──────────────────────────────────────────────────── */
.wpbm-mobile-nav {
    display: none !important;
    position: fixed;
    inset: 0;
    z-index: 9000;
}
.wpbm-mobile-nav.wpbm-mobile-nav--open {
    display: flex !important;
    flex-direction: column;
}
.wpbm-mobile-nav__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
}
.wpbm-mobile-nav__panel {
    position: relative;
    z-index: 1;
    background: var(--wpbm-green);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 0 0 20px 20px;
    display: flex;
    flex-direction: column;
    animation: wpbm-slide-down .22s ease;
}
@keyframes wpbm-slide-down {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
.wpbm-mobile-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    position: sticky;
    top: 0;
    background: var(--wpbm-green);
    z-index: 2;
}
.wpbm-mobile-nav__title {
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
}
.wpbm-mobile-nav__close {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    font-size: 1rem;
    border-radius: 6px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* Tile grid */
.wpbm-mobile-nav__tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 16px 16px 8px;
}
.wpbm-mobile-nav__tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 14px 6px;
    border-radius: 12px;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.88);
    text-decoration: none;
    font-size: .72rem;
    text-align: center;
    line-height: 1.3;
    border: 1.5px solid transparent;
    transition: background .15s;
    -webkit-tap-highlight-color: transparent;
}
.wpbm-mobile-nav__tile:hover,
.wpbm-mobile-nav__tile:active {
    background: rgba(255,255,255,.16);
}
.wpbm-mobile-nav__tile--active {
    background: rgba(200,169,81,.2);
    border-color: var(--wpbm-accent);
    color: #fff;
}
.wpbm-mobile-nav__tile-icon {
    font-size: 1.5rem;
    line-height: 1;
}
.wpbm-mobile-nav__tile-label {
    font-size: .72rem;
}
.wpbm-mobile-nav__footer {
    padding: 12px 16px 20px;
}
.wpbm-mobile-nav__logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    border-radius: 10px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.8);
    text-decoration: none;
    font-size: .875rem;
    transition: background .15s;
}
.wpbm-mobile-nav__logout:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.wpbm-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 18px;
    overflow: hidden;
}
.wpbm-card-header {
    background: #f8f9fa;
    padding: 12px 18px;
    border-bottom: 1px solid #e2e8f0;
}
.wpbm-card-header h3 { margin: 0; font-size: .95rem; font-weight: 600; }

/* ── Section header ──────────────────────────────────────────────────────── */
.wpbm-section-header { margin-bottom: 20px; }
.wpbm-section-header h2 {
    margin: 0 0 4px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--wpbm-green);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.wpbm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: .72rem;
    font-weight: 600;
}
.wpbm-badge-success   { background: #d4edda; color: #155724; }
.wpbm-badge-danger    { background: #f8d7da; color: #721c24; }
.wpbm-badge-warning   { background: #fff3cd; color: #856404; }
.wpbm-badge-info      { background: #d1ecf1; color: #0c5460; }
.wpbm-badge-secondary { background: #e2e3e5; color: #383d41; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.wpbm-btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: .15s;
}
.wpbm-btn-primary { background: var(--wpbm-green); color: #fff; }
.wpbm-btn-primary:hover { background: var(--wpbm-green-light); color: #fff; }
.wpbm-btn-outline { background: #fff; color: var(--wpbm-green); border: 1.5px solid var(--wpbm-green); }
.wpbm-btn-outline:hover { background: var(--wpbm-green); color: #fff; }
.wpbm-btn-sm   { padding: 5px 12px; font-size: .8rem; }
.wpbm-btn-full { width: 100%; text-align: center; display: block; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.wpbm-form-group { margin-bottom: 16px; }
.wpbm-form-group label {
    display: block;
    font-weight: 600;
    font-size: .875rem;
    margin-bottom: 5px;
    color: #374151;
}
.wpbm-form-group input,
.wpbm-form-group select,
.wpbm-form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: .9rem;
    box-sizing: border-box;
    transition: .15s;
}
.wpbm-form-group input:focus,
.wpbm-form-group select:focus,
.wpbm-form-group textarea:focus {
    outline: none;
    border-color: var(--wpbm-green);
    box-shadow: 0 0 0 3px rgba(26,58,46,.1);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.wpbm-table-wrap { overflow-x: auto; }
.wpbm-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.wpbm-table th {
    background: #f8f9fa;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #6b7280;
}
.wpbm-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.wpbm-table tr:last-child td { border-bottom: none; }
.wpbm-table tr:hover td { background: #fafafa; }

/* ── Notices ─────────────────────────────────────────────────────────────── */
.wpbm-notice {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: .875rem;
}
.wpbm-notice-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.wpbm-notice-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.wpbm-notice-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Portal error ────────────────────────────────────────────────────────── */
.wpbm-portal-error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ─────────────────────────────────────────────────────────────────────────
   Breakpoints:
     1024px — tablet/mobile: hide sidebar, show hamburger
     480px  — small mobile:  2-column tile grid, tighten content padding
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {

    /* On mobile the wrap reverts to natural flow — no fixed height */
    .wpbm-portal-wrap {
        height: auto;
        overflow: visible;
    }

    /* Body reverts to single column, natural height */
    .wpbm-portal-body {
        grid-template-columns: 1fr;
        flex: none;
        overflow: visible;
        min-height: auto;
    }

    /* Content area — natural scroll on mobile */
    .wpbm-portal-content {
        height: auto;
        overflow-y: visible;
    }

    /* Show hamburger */
    .wpbm-hamburger {
        display: flex;
    }

    /* Hide user meta text on very small headers to avoid squash */
    .wpbm-portal-header__user {
        display: none;
    }

    /* Hide desktop sidebar completely */
    .wpbm-portal-nav {
        display: none;
    }

    /* Tighten content padding on mobile */
    .wpbm-portal-content {
        padding: 16px;
    }

    /* Property switcher — adjust margins to match new padding */
    .wpbm-property-switcher {
        margin: -16px -16px 16px -16px;
        padding: 10px 16px;
    }

    /* Header brand — truncate long company names */
    .wpbm-portal-header__brand {
        min-width: 0;
    }
    .wpbm-portal-header__brand > div {
        overflow: hidden;
    }
    .wpbm-portal-header__brand > div > div:first-child {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Tables — allow horizontal scroll */
    .wpbm-table-wrap {
        -webkit-overflow-scrolling: touch;
    }

    /* Cards — remove horizontal overflow clipping that breaks tables */
    .wpbm-card {
        overflow: visible;
    }

}

@media (max-width: 480px) {

    /* 2-column tile grid on very small screens */
    .wpbm-mobile-nav__tiles {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Even tighter content padding */
    .wpbm-portal-content {
        padding: 12px;
    }

    .wpbm-property-switcher {
        margin: -12px -12px 12px -12px;
        padding: 8px 12px;
    }

    /* Section headings */
    .wpbm-section-header h2 {
        font-size: 1.15rem;
    }

    /* Buttons full-width on small screens */
    .wpbm-btn {
        padding: 10px 14px;
    }

}

/* On desktop — never show the mobile overlay regardless of JS state */
@media (min-width: 1025px) {
    .wpbm-mobile-nav {
        display: none !important;
    }
    .wpbm-hamburger {
        display: none !important;
    }
    /* Restore user info on desktop */
    .wpbm-portal-header__user {
        display: block;
    }
}