/* BeTheBoss Admin Portal — brand-aligned admin shell. */

:root {
    --p-red:        #ea1510;
    --p-dark-red:   #A01830;
    --p-navy:       #1A2B4A;
    --p-blue:       #2B4C7E;
    --p-light-blue: #E8EDF4;
    --p-light-gray: #F7F7F7;
    --p-border:     #E0E0E0;
    --p-text:       #1A2B4A;
    --p-text-muted: #6b7682;
    --p-sidebar-bg: #0f1a30;
    --p-sidebar-fg: #cdd6e4;
    --p-sidebar-active: #ea1510;
}

html, body {
    background: var(--p-light-gray);
    color: var(--p-text);
    font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    min-height: 100vh;
    margin: 0;
}

a { color: var(--p-blue); text-decoration: none; }
a:hover { color: var(--p-red); text-decoration: underline; }

/* ---------- shell ---------- */
.portal-shell {
    display: grid;
    grid-template-columns: 248px 1fr;
    min-height: 100vh;
}

.portal-sidebar {
    background: var(--p-sidebar-bg);
    color: var(--p-sidebar-fg);
    display: flex;
    flex-direction: column;
    padding: 18px 0 0 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.portal-brand {
    padding: 0 22px 18px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 14px;
}

.portal-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.4px;
    line-height: 1;
}

.portal-brand-mark-LEGACY {
    background: var(--p-red);
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 6px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.portal-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.6px;
}

.portal-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0 10px;
}

.portal-nav-section {
    color: rgba(255,255,255,0.45);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 18px 12px 6px;
}

.portal-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--p-sidebar-fg);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.12s, color 0.12s;
}

.portal-nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    text-decoration: none;
}

.portal-nav-link.active {
    background: var(--p-sidebar-active);
    color: #fff;
}

.portal-nav-link.active i {
    color: #fff;
}

.portal-nav-link i { color: rgba(255,255,255,0.6); width: 18px; text-align: center; }

.portal-signout {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 14px 18px;
    margin-top: auto;
}

.portal-signout-user {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    margin-bottom: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.portal-signout-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.85);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.12s, color 0.12s;
}

.portal-signout-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* ---------- main content area ---------- */
.portal-main {
    padding: 0 32px 60px;     /* topbar provides its own top padding */
    background: var(--p-light-gray);
    overflow-x: hidden;
}

.portal-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 14px 0 16px;
    border-bottom: 1px solid var(--p-border);
    margin-bottom: 22px;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--p-light-gray);
}

.portal-topbar-link { display: inline-block; line-height: 0; }
.portal-topbar-logo { height: 56px; width: auto; mix-blend-mode: multiply; }
@@media (max-width: 575.98px) {
    .portal-topbar-logo { height: 42px; }
    .portal-main { padding: 0 18px 40px; }
}

.portal-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}

.portal-page-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.7rem;
    color: var(--p-navy);
    margin: 0;
}

.portal-page-subtitle {
    color: var(--p-text-muted);
    font-size: 0.9rem;
    margin-top: 2px;
}

.portal-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(20,30,50,0.08);
    padding: 22px 24px;
    margin-bottom: 18px;
}

.portal-card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--p-navy);
    margin: 0 0 12px 0;
}

.portal-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.portal-stat {
    background: linear-gradient(135deg, var(--p-navy) 0%, var(--p-blue) 100%);
    color: #fff;
    border-radius: 10px;
    padding: 18px 20px;
}

.portal-stat-label {
    color: rgba(255,255,255,0.75);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.portal-stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    margin-top: 4px;
}

.portal-coming-soon {
    text-align: center;
    color: var(--p-text-muted);
    padding: 60px 20px;
}

.portal-coming-soon i {
    font-size: 2.5rem;
    color: var(--p-border);
    margin-bottom: 14px;
}

/* ---------- table ---------- */
.portal-table {
    width: 100%;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(20,30,50,0.08);
    border-collapse: separate;
    border-spacing: 0;
}

.portal-table thead th {
    text-align: left;
    background: var(--p-light-blue);
    color: var(--p-navy);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--p-border);
}

.portal-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--p-light-gray);
    font-size: 0.92rem;
    vertical-align: middle;
}

.portal-table tbody tr:hover { background: var(--p-light-gray); }

.portal-table img.portal-table-logo {
    height: 36px;
    width: auto;
    max-width: 70px;
    object-fit: contain;
}

/* Sortable column headers — used by any .portal-sortable table.
   Click a header to sort, click again to reverse. CSS lives here (not inline
   on each page) so all portal grids look + behave the same way. */
.portal-sortable th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.portal-sortable th.sortable i {
    opacity: 0.35;
    margin-left: 4px;
    font-size: 0.75rem;
}
.portal-sortable th.sortable:hover         { background: rgba(0, 0, 0, 0.04); }
.portal-sortable th.sortable:hover i       { opacity: 0.7; }
.portal-sortable th.sortable.sort-asc i,
.portal-sortable th.sortable.sort-desc i   { opacity: 1; color: var(--p-red); }

/* Server-side sort header links (paginated grids — sort holds across pages).
   The <th> contains an <a class="portal-sort-link"> instead of the client-side
   .sortable behaviour above. */
.portal-sort-link            { color: inherit; text-decoration: none; white-space: nowrap; cursor: pointer; }
.portal-sort-link:hover      { color: var(--p-red); }
.portal-sort-link i          { margin-left: 4px; font-size: 0.75rem; }
.portal-sort-link i.fa-sort  { opacity: 0.35; }            /* inactive column */
.portal-sort-link i.fa-sort-up,
.portal-sort-link i.fa-sort-down { color: var(--p-red); }  /* active column */

.portal-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.portal-pill-featured { background: var(--p-red); color: #fff; }
.portal-pill-active   { background: #d6efd9; color: #1a5d34; }
.portal-pill-draft    { background: #fff3cd; color: #7a5b14; }
.portal-pill-inactive { background: #f3d6d4; color: #8a1818; }

/* ---------- editor tabs ---------- */
.portal-edit-tabs { border-bottom: 2px solid var(--p-border); flex-wrap: wrap; }
.portal-edit-tabs .nav-link {
    color: var(--p-text-muted);
    font-weight: 600;
    border: none;
    padding: 10px 16px;
    background: transparent;
}
.portal-edit-tabs .nav-link.active {
    color: var(--p-navy);
    border-bottom: 3px solid var(--p-red);
    background: transparent;
}
.portal-edit-tab-content { padding-top: 18px; }

.portal-ai-card {
    background: #fff8e1;
    border: 1px solid #ffe082;
}
.portal-ai-card h2 i { color: var(--p-blue); }
.portal-ai-card .btn-outline-warning {
    border-color: #ffb300;
    color: #6f4e00;
    background: #fff;
}
.portal-ai-card .btn-outline-warning:disabled { opacity: 0.7; }

/* ---------- AI preview modal — render booth-like ---------- */
.ai-preview-rendered {
    padding: 18px 22px;
    background: #fff;
    border: 1px solid var(--p-border);
    border-radius: 8px;
    color: var(--p-text);
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.55;
}
.ai-preview-rendered h1,
.ai-preview-rendered h2 {
    color: var(--p-navy);
    font-weight: 700;
    margin-top: 1.1rem;
    margin-bottom: 0.5rem;
}
.ai-preview-rendered h2 { font-size: 1.35rem; }
.ai-preview-rendered h3 { color: var(--p-navy); font-size: 1.1rem; margin-top: 0.9rem; }
.ai-preview-rendered p  { margin-bottom: 0.85rem; }
.ai-preview-rendered ul, .ai-preview-rendered ol { margin-bottom: 0.85rem; padding-left: 1.4rem; }
.ai-preview-rendered li { margin-bottom: 0.25rem; }
.ai-preview-rendered img { max-width: 100%; height: auto; display: block; margin: 0.6rem auto; }
.ai-preview-rendered blockquote {
    border-left: 3px solid var(--p-red);
    margin: 1rem 0;
    padding: 0.4rem 1rem;
    color: var(--p-text-muted);
}
.ai-preview-rendered a { color: var(--p-blue); }

.ai-preview-section { border: 1px solid var(--p-border); border-radius: 8px; padding: 16px 18px; margin-bottom: 12px; background: #fff; }
.ai-preview-section-tag {
    display: inline-block;
    background: var(--p-light-blue);
    color: var(--p-navy);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 12px;
    margin-bottom: 6px;
}
.ai-preview-faq { border: 1px solid var(--p-border); border-radius: 8px; padding: 12px 16px; margin-bottom: 8px; background: #fff; }
.ai-preview-faq summary { cursor: pointer; }

/* ---------- dashboard hero ---------- */
.portal-dashboard-hero {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 22px 26px;
    margin-bottom: 22px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(20,30,50,0.08);
}

.portal-dashboard-logo {
    height: 78px;
    width: auto;
    flex: 0 0 auto;
}

@@media (max-width: 575.98px) {
    .portal-dashboard-hero { flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px; }
    .portal-dashboard-logo { height: 64px; }
}

/* ---------- login page (no shell) ---------- */
.portal-login-shell {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--p-navy) 0%, var(--p-blue) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.portal-login-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    padding: 36px 36px 30px;
    width: 100%;
    max-width: 380px;
}

.portal-login-brand {
    text-align: center;
    margin-bottom: 22px;
}

.portal-login-brand-mark {
    background: var(--p-red);
    color: #fff;
    font-weight: 800;
    padding: 8px 12px;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

.portal-login-card h1 {
    text-align: center;
    font-size: 1.4rem;
    color: var(--p-navy);
    margin: 14px 0 4px;
    font-weight: 700;
}

.portal-login-card .sub {
    text-align: center;
    color: var(--p-text-muted);
    font-size: 0.9rem;
    margin: 0 0 22px;
}

.portal-login-card label {
    font-weight: 600;
    color: var(--p-navy);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.portal-login-card input[type=email],
.portal-login-card input[type=password],
.portal-login-card input[type=text] {
    width: 100%;
    padding: 9px 12px;
    border-radius: 7px;
    border: 1px solid var(--p-border);
    font-size: 0.95rem;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.portal-login-card input:focus {
    outline: none;
    border-color: var(--p-red);
    box-shadow: 0 0 0 3px rgba(234,21,16,0.15);
}

.portal-login-logo {
    display: block;
    margin: 0 auto 14px;
    max-width: 180px;
    height: auto;
}

.portal-login-card input.code-box {
    font-size: 1.6rem;
    letter-spacing: 0.5rem;
    text-align: center;
    font-weight: 700;
    padding: 14px 12px;
    height: auto;
}

.portal-login-card .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 16px;
}

.portal-login-card .form-check-input {
    margin-top: 0;
    flex-shrink: 0;
}

.portal-login-card .form-check-label {
    font-size: 0.82rem;
    color: var(--p-text-muted);
    line-height: 1.3;
    margin: 0;
}

.portal-login-card .btn-signin {
    width: 100%;
    background: var(--p-red);
    color: #fff;
    border: none;
    padding: 11px;
    border-radius: 7px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.12s;
}

.portal-login-card .btn-signin:hover { background: var(--p-dark-red); }

.portal-login-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 0.88rem;
    margin-bottom: 14px;
}

/* Floating action button — used by the franchise edit page to keep
   "View public booth" reachable without scrolling. */
.portal-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1050;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: var(--p-navy);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.22);
    transition: transform 0.12s ease, background 0.12s ease;
}

.portal-fab:hover {
    background: var(--p-blue);
    color: #fff;
    transform: translateY(-1px);
}

.portal-fab i {
    font-size: 0.95rem;
}

@@media (max-width: 575.98px) {
    .portal-fab span { display: none; }
    .portal-fab { padding: 14px; }
}

/* AI image attachment row inside the AI assistant panel */
.ai-attach-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f7f7fa;
    border: 1px solid #d8d8e0;
    border-radius: 999px;
    padding: 4px 10px 4px 4px;
    font-size: 0.85rem;
    max-width: 100%;
}

.ai-attach-chip img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
}

.ai-attach-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.ai-attach-chip .btn-close {
    font-size: 0.65rem;
    padding: 0;
    width: 14px;
    height: 14px;
}

/* ----------------------------------------------------------------------
   Shared admin-grid bits — promoted from Franchises/Index.cshtml so the
   Listings, CommercialProperty, and BusinessServices admin grids share
   the same expiry-date colouring and 30-day leads pill styling.
---------------------------------------------------------------------- */
.franchise-expires           { white-space: nowrap; font-variant-numeric: tabular-nums; }
.franchise-expires.expired   { color: #c0291d; font-weight: 700; }
.franchise-expires.exp-soon  { color: #b45309; font-weight: 600; }

.franchise-leads-pill         { display: inline-block; min-width: 32px; padding: 3px 10px; border-radius: 999px; background: var(--p-navy, #1A2B4A); color: #fff; font-weight: 700; font-size: .85rem; text-decoration: none; }
.franchise-leads-pill:hover   { background: var(--p-red, #ea1510); color: #fff; text-decoration: none; }

/* ===== Show/hide password toggle (JS-injected eye button) ===== */
.pw-toggle-wrap { position: relative; display: block; }
.pw-toggle-wrap > input { width: 100%; padding-right: 2.75rem; }
.pw-toggle-btn {
    position: absolute; top: 0; right: 0; height: 100%; width: 2.75rem;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 0; padding: 0; margin: 0;
    color: #6b7682; cursor: pointer; font-size: 1rem; line-height: 1;
}
.pw-toggle-btn:hover, .pw-toggle-btn:focus { color: #1a2b4a; outline: none; }
/* ── Rich-text description editor (basic WYSIWYG over a contenteditable box) ── */
.rich-editor-toolbar {
    display: flex; gap: 4px; flex-wrap: wrap;
    padding: 6px; background: #f8f9fa;
    border: 1px solid #ced4da; border-bottom: 0; border-radius: 6px 6px 0 0;
}
.rich-editor-btn {
    min-width: 34px; padding: 4px 9px; line-height: 1; font-size: .9rem;
    background: #fff; border: 1px solid #ced4da; border-radius: 4px; cursor: pointer; color: #1f2937;
}
.rich-editor-btn:hover { background: #eef1f4; }
.rich-editor-area {
    min-height: 150px; height: auto; overflow-y: auto;
    border-top-left-radius: 0; border-top-right-radius: 0;
}
.rich-editor-area:focus { outline: none; }
.rich-editor-area p  { margin: 0 0 .6em; }
.rich-editor-area ul, .rich-editor-area ol { margin: 0 0 .6em 1.4em; }
