/**
 * StayMint Material Design 3 — Admin CSS
 *
 * M3 design tokens, layout classes, page-specific components.
 * Used by wp-admin pages only. Portal templates use their own styles.
 * Version: 3.0
 */

/* ──────────────────────────────────────────────
   Self-hosted Fonts (no CDN dependency)
   ────────────────────────────────────────────── */

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/roboto-400.woff2') format('woff2');
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('fonts/roboto-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/roboto-700.woff2') format('woff2');
}

@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    font-display: swap;
    src: url('fonts/MaterialSymbolsOutlined.woff2') format('woff2');
}

/* ──────────────────────────────────────────────
   M3 Design Tokens
   ────────────────────────────────────────────── */

:root {
    /* ── StayMint brand palette ── */
    --sm-mint:     #03d3ac;   /* primary brand accent (client-loved) */
    --sm-mint-l4:  #abf0e3;
    --sm-mint-l5:  #d5f8f1;
    --sm-mint-d3:  #026a56;
    --sm-green:    #0c794d;   /* secondary — actions/links/money (5.4:1 on white) */
    --sm-green-d:  #0c643b;   /* hover / strong text (7.2:1 on white) */
    --sm-gray:     #616060;   /* brand gray */

    /* M3 tokens remapped onto the brand: green = action, mint = accent,
       gray = neutral. No blue, no purple. */
    --md-sys-color-primary: #0c794d;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #d5f8f1;
    --md-sys-color-on-primary-container: #0c643b;
    --md-sys-color-secondary-container: #abf0e3;
    --md-sys-color-on-secondary-container: #026a56;
    --md-sys-color-surface: #FFFFFF;
    --md-sys-color-surface-container: #eef2f0;
    --md-sys-color-surface-container-low: #f4f8f7;
    --md-sys-color-surface-container-highest: #dde4e1;
    --md-sys-color-on-surface: #2b2f2e;
    --md-sys-color-on-surface-variant: #4d5250;
    --md-sys-color-outline: #7c8480;
    --md-sys-color-outline-variant: #d3d9d6;
    --md-sys-color-error: #B3261E;
    --md-sys-color-tertiary: #616060;
    --md-sys-color-tertiary-container: #eef2f0;
    --md-sys-color-on-tertiary-container: #4d5250;

    --md-filled-button-container-shape: 20px;
    --md-outlined-button-container-shape: 20px;
    --md-filled-tonal-button-container-shape: 20px;
    --md-outlined-text-field-container-shape: 4px;
    --md-outlined-select-text-field-container-shape: 4px;

    /* Force Roboto on all M3 components (including dialogs hoisted to body) */
    --md-ref-typeface-plain: 'Roboto', sans-serif;
    --md-ref-typeface-brand: 'Roboto', sans-serif;
    --md-sys-typescale-body-large-font: 'Roboto', sans-serif;
    --md-sys-typescale-body-medium-font: 'Roboto', sans-serif;
    --md-sys-typescale-body-small-font: 'Roboto', sans-serif;
    --md-sys-typescale-label-large-font: 'Roboto', sans-serif;
    --md-sys-typescale-label-medium-font: 'Roboto', sans-serif;
    --md-sys-typescale-label-small-font: 'Roboto', sans-serif;
    --md-sys-typescale-title-large-font: 'Roboto', sans-serif;
    --md-sys-typescale-title-medium-font: 'Roboto', sans-serif;
    --md-sys-typescale-title-small-font: 'Roboto', sans-serif;
    --md-sys-typescale-headline-small-font: 'Roboto', sans-serif;
    --md-sys-typescale-headline-medium-font: 'Roboto', sans-serif;
    --md-sys-typescale-headline-large-font: 'Roboto', sans-serif;
}

/* ──────────────────────────────────────────────
   Base + WP Admin Integration
   ────────────────────────────────────────────── */

.staymint-content {
    background: #FFFFFF;
    min-height: calc(100vh - 32px);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--md-sys-color-on-surface);
    -webkit-font-smoothing: antialiased;
    margin-left: -20px;
    padding-bottom: 1px;
}

.staymint-content *:not(
    md-filled-button, md-outlined-button, md-filled-tonal-button, md-text-button,
    md-icon-button, md-fab, md-dialog, md-assist-chip, md-filter-chip, md-switch
) {
    box-sizing: border-box;
}


/* ──────────────────────────────────────────────
   Top App Bar
   ────────────────────────────────────────────── */

.top-app-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 24px;
    height: 64px;
    margin-bottom: 16px;
    background: var(--md-sys-color-surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-app-bar h1 {
    font-size: 22px;
    font-weight: 400;
    flex: 1;
    margin: 0;
    padding: 0;
}

.top-app-bar .actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ──────────────────────────────────────────────
   Page Layout
   ────────────────────────────────────────────── */

.page-layout {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* ──────────────────────────────────────────────
   Settings Grid (2-column)
   ────────────────────────────────────────────── */

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.settings-grid .card.full-width {
    grid-column: 1 / -1;
}

/* ──────────────────────────────────────────────
   Stat Cards
   ────────────────────────────────────────────── */

.stat-row {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-row.cols-6 { grid-template-columns: repeat(6, 1fr); }

.stat-card {
    background: var(--md-sys-color-surface-container-low);
    border-radius: 12px;
    padding: 16px 20px;
}

.stat-card.large { padding: 20px 24px; }

.stat-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
}

.stat-value.large { font-size: 28px; }
.stat-value.primary { color: var(--md-sys-color-primary); }
.stat-value.tertiary { color: var(--md-sys-color-tertiary); }
.stat-value.green { color: var(--sm-green); }

/* "Your Payout" hero — the single green-filled card anchoring the stat row */
.stat-card:has(.stat-value.green) {
    background: linear-gradient(135deg, var(--sm-green) 0%, var(--sm-green-d) 100%);
}
.stat-card:has(.stat-value.green) .stat-label { color: rgba(255, 255, 255, 0.85); }
.stat-card:has(.stat-value.green) .stat-value.green { color: #FFFFFF; }

/* ──────────────────────────────────────────────
   Card
   ────────────────────────────────────────────── */

.staymint-content .card {
    background: var(--md-sys-color-surface-container-low) !important;
    border-radius: 12px !important;
    overflow: hidden;
    margin-bottom: 16px !important;
    max-width: none !important;
    padding: 0 !important;
    font-size: inherit !important;
    border: none !important;
    box-shadow: none !important;
}

.staymint-content .card.padded { padding: 24px !important; }

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 0;
}

.card.padded .card-header {
    padding: 0;
    margin-bottom: 8px;
}

.card-header md-icon {
    color: var(--md-sys-color-primary);
    font-size: 24px;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 500;
    flex: 1;
    margin: 0;
    padding: 0;
}

.card-description {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.5;
    margin-bottom: 20px;
}

.card-description a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
}

.card-description a:hover { text-decoration: underline; }

.card-description code {
    background: var(--md-sys-color-surface-container);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    word-break: break-all;
}

/* ──────────────────────────────────────────────
   Import Banner
   ────────────────────────────────────────────── */

.import-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

/* ──────────────────────────────────────────────
   Filter Bar
   ────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar .spacer { flex: 1; }
.filter-bar md-outlined-select { width: 180px; }

/* ──────────────────────────────────────────────
   Toolbar
   ────────────────────────────────────────────── */

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar .spacer { flex: 1; }

/* ──────────────────────────────────────────────
   Form Fields
   ────────────────────────────────────────────── */

.field-single { margin-bottom: 16px; }

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}

.field-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}

md-outlined-text-field,
md-filled-text-field,
md-outlined-select,
md-filled-select {
    width: 100%;
}

/* ──────────────────────────────────────────────
   Status Chips
   ────────────────────────────────────────────── */

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-chip.active { background: #C8E6C9; color: #1B5E20; }
.status-chip.pending { background: #FFF3E0; color: #E65100; }
.status-chip.archived { background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }
.status-chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.status-chip.active .dot { background: #2E7D32; }
.status-chip.pending .dot { background: #EF6C00; }

.status-chip-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    background: #C8E6C9;
    color: #1B5E20;
}

.status-chip-bar .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2E7D32;
}

/* ──────────────────────────────────────────────
   Toggle Rows (Settings)
   ────────────────────────────────────────────── */

.toggle-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
}

.toggle-row + .toggle-row {
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.toggle-info { flex: 1; }

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.toggle-desc {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 2px;
}

/* ──────────────────────────────────────────────
   Status Row (Settings)
   ────────────────────────────────────────────── */

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-row.success { color: #1B5E20; }
.status-row.success md-icon { color: #2E7D32; font-size: 18px; }

/* ──────────────────────────────────────────────
   Dialog Fields
   ────────────────────────────────────────────── */

.dialog-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

.dialog-fields md-outlined-text-field { width: 100%; }

/* ──────────────────────────────────────────────
   Tabs
   ────────────────────────────────────────────── */

md-tabs {
    --md-primary-tab-container-color: var(--md-sys-color-surface);
}

/* ──────────────────────────────────────────────
   Tab Panels (Property Edit)
   ────────────────────────────────────────────── */

.tab-panel {
    display: none;
    padding-top: 24px;
}

.tab-panel.active { display: block; }

/* ══════════════════════════════════════════════
   PAGE: Reservations (Ledger)
   ══════════════════════════════════════════════ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: var(--md-sys-color-surface-container);
}

.data-table th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--md-sys-color-on-surface-variant);
    text-align: left;
    white-space: nowrap;
}

.data-table th.amt { text-align: right; }

.data-table td {
    padding: 12px 16px;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    vertical-align: middle;
}

.data-table td.amt {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table tbody tr {
    border-top: 1px solid var(--md-sys-color-outline-variant);
    cursor: pointer;
    transition: background 0.15s;
}

.data-table tbody tr:first-child { border-top: none; }
.data-table tbody tr:hover { background: var(--md-sys-color-surface-container); }

.data-table .month-header td {
    background: var(--md-sys-color-surface-container-low);
    font-weight: 500;
    font-size: 13px;
    color: var(--md-sys-color-on-surface);
    padding: 10px 16px;
    border-top: 2px solid var(--md-sys-color-outline-variant);
}

.data-table .total-row td {
    font-weight: 500;
    background: var(--md-sys-color-surface-container);
    border-top: 1px solid var(--md-sys-color-outline);
}

.source-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
}

/* OTA channels unified to brand gray; family/owner uses the mint accent. */
.source-chip.airbnb { background: #fdeeee; color: #c0343a; }
.source-chip.vrbo { background: #edf1f8; color: #2f4a80; }
.source-chip.booking { background: #e9eff7; color: #003580; }
.source-chip.direct { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.source-chip.family { background: var(--sm-mint-l4); color: var(--sm-mint-d3); }

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
}

.table-footer strong {
    color: var(--md-sys-color-on-surface);
}

/* ══════════════════════════════════════════════
   PAGE: Owners
   ══════════════════════════════════════════════ */

.owner-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    cursor: pointer;
    transition: background 0.15s;
}

.owner-item:hover { background: var(--md-sys-color-surface-container); }
.owner-item + .owner-item { border-top: 1px solid var(--md-sys-color-outline-variant); }

.owner-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
    color: var(--md-sys-color-on-primary-container);
    background: var(--md-sys-color-primary-container);
}

.owner-avatar.alt {
    color: var(--md-sys-color-on-tertiary-container);
    background: var(--md-sys-color-tertiary-container);
}

.owner-info { flex: 1; min-width: 0; }
.owner-name { font-size: 14px; font-weight: 500; color: var(--md-sys-color-on-surface); }
.owner-email { font-size: 12px; color: var(--md-sys-color-on-surface-variant); margin-top: 2px; }

.owner-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.owner-phone { font-size: 13px; color: var(--md-sys-color-on-surface-variant); white-space: nowrap; }
.owner-date { font-size: 12px; color: var(--md-sys-color-outline); white-space: nowrap; }

.invite-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
}

.invite-item + .invite-item { border-top: 1px solid var(--md-sys-color-outline-variant); }

.invite-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.invite-info { flex: 1; min-width: 0; }
.invite-email-text { font-size: 14px; font-weight: 500; color: var(--md-sys-color-on-surface); }
.invite-detail { font-size: 12px; color: var(--md-sys-color-on-surface-variant); margin-top: 2px; }

.invite-status {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 100px;
    flex-shrink: 0;
}

.invite-status.pending-inv { background: #FFF3E0; color: #E65100; }
.invite-status.expired { background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }

.invite-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   PAGE: Properties
   ══════════════════════════════════════════════ */

.property-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    cursor: pointer;
    transition: background 0.15s;
}

.property-item:hover { background: var(--md-sys-color-surface-container); }
.property-item + .property-item { border-top: 1px solid var(--md-sys-color-outline-variant); }

.property-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.property-icon.pending-prop { background: #FFF3E0; color: #E65100; }

.property-info { flex: 1; min-width: 0; }
.property-name { font-size: 14px; font-weight: 500; color: var(--md-sys-color-on-surface); }
.property-listing { font-size: 12px; color: var(--md-sys-color-on-surface-variant); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.property-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.property-detail { text-align: right; min-width: 70px; }
.property-detail-label { font-size: 11px; color: var(--md-sys-color-on-surface-variant); text-transform: uppercase; letter-spacing: 0.3px; }
.property-detail-value { font-size: 14px; font-weight: 500; color: var(--md-sys-color-on-surface); font-variant-numeric: tabular-nums; }

.owner-tag {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.owner-tag md-icon { font-size: 14px; }

/* ══════════════════════════════════════════════
   PAGE: Property Edit
   ══════════════════════════════════════════════ */

.feed-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
}

.feed-row + .feed-row { border-top: 1px solid var(--md-sys-color-outline-variant); }

.feed-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
}

.feed-icon.airbnb { background: #FF5A5F; }
.feed-icon.booking { background: #003580; }
.feed-icon.vrbo { background: #3B5998; }

.feed-info { flex: 1; min-width: 0; }
.feed-label { font-size: 14px; font-weight: 500; }
.feed-url { font-size: 12px; color: var(--md-sys-color-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.feed-status {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 100px;
    flex-shrink: 0;
}

.feed-status.connected { background: #C8E6C9; color: #1B5E20; }
.feed-status.empty { background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }

.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--md-sys-color-on-surface-variant);
}

.empty-state md-icon {
    font-size: 48px;
    color: var(--md-sys-color-outline);
    display: block;
    margin: 0 auto 12px;
}

.empty-state .title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--md-sys-color-on-surface);
}

.empty-state .body { font-size: 14px; }

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    background: var(--md-sys-color-surface-container-low);
}

.action-card:hover { background: var(--md-sys-color-surface-container); }

.action-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    flex-shrink: 0;
}

.action-icon.danger {
    background: #FFDAD6;
    color: var(--md-sys-color-error);
}

.action-text { flex: 1; }
.action-title { font-size: 14px; font-weight: 500; }
.action-desc { font-size: 12px; color: var(--md-sys-color-on-surface-variant); margin-top: 2px; }

.log-entry {
    display: flex;
    gap: 12px;
    padding: 12px 0;
}

.log-entry + .log-entry { border-top: 1px solid var(--md-sys-color-outline-variant); }

.log-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    margin-top: 6px;
    flex-shrink: 0;
}

.log-time { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.log-text { font-size: 14px; }

/* ══════════════════════════════════════════════
   Alerts (success/error/warning banners)
   ══════════════════════════════════════════════ */

.sm-alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sm-alert-success {
    background: #C8E6C9;
    color: #1B5E20;
}

.sm-alert-warning {
    background: #FFF3E0;
    color: #E65100;
}

.sm-alert-error {
    background: #FFDAD6;
    color: var(--md-sys-color-error);
}

/* ══════════════════════════════════════════════
   Print Styles
   ══════════════════════════════════════════════ */

@media print {
    #wpadminbar,
    #adminmenuwrap,
    #adminmenuback,
    .top-app-bar .actions,
    .filter-bar,
    .theme-switcher,
    md-icon-button {
        display: none !important;
    }

    .staymint-content {
        margin: 0;
        padding: 0;
        background: #fff;
    }

    .page-layout {
        max-width: 100%;
        padding: 0;
    }

    .data-table {
        font-size: 11px;
    }

    .data-table td,
    .data-table th {
        padding: 6px 8px;
    }
}

/* ══════════════════════════════════════════════════
   PORTAL: Owner-Facing Front-End
   ══════════════════════════════════════════════════ */

/* ── Portal Nav Bar ── */

.portal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 64px;
    padding: 0 24px;
    background: #FFFFFF;
    border-bottom: 1px solid #03d3ac;
    position: sticky;
    top: 0;
    z-index: 100;
    font-family: 'Roboto', sans-serif;
}

.portal-nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    margin-right: 24px;
}

.portal-nav-logo img {
    height: 32px;
    width: auto;
    display: block;
}

.portal-nav-links {
    display: flex;
    gap: 4px;
    flex: 1;
}

.portal-nav-link {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    border-radius: 20px;
    transition: background 0.15s, color 0.15s;
}

.portal-nav-link:hover {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
}

.portal-nav-link.active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.portal-nav-property {
    font-size: 13px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    padding: 6px 12px;
    background: var(--md-sys-color-surface-container-low);
    border-radius: 8px;
    margin-right: 8px;
}

.portal-nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    margin-left: auto;
}

/* ── Portal Content ── */

.portal-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 24px 80px;
    font-family: 'Roboto', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.portal-content h1 {
    font-size: 28px;
    font-weight: 400;
    margin: 0 0 8px;
    padding: 0;
}

.portal-content h2 {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    padding: 0;
}

.portal-content h3 {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 12px;
    padding: 0;
    color: var(--md-sys-color-on-surface-variant);
}

/* ── Login / Signup Card ── */

/* ── Split Screen Login ── */

.login-split {
    display: flex;
    min-height: 100vh;
}

.login-hero {
    flex: 1;
    background-size: cover;
    background-position: center;
    position: relative;
}

.login-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(65, 166, 126, 0.25) 0%, rgba(0, 0, 0, 0.15) 100%);
}

.login-hero-text {
    position: absolute;
    bottom: 40px;
    left: 40px;
    right: 40px;
    color: #FFFFFF;
    z-index: 1;
}

.login-hero-text h2 {
    font-size: 28px;
    font-weight: 500;
    margin: 0 0 8px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.login-hero-text p {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.login-form-side {
    flex: 0 0 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #FFFFFF;
}

.login-card {
    background: #FFFFFF;
    padding: 0;
    width: 100%;
    max-width: 380px;
    font-family: 'Roboto', sans-serif;
}

.login-card h1 {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    margin: 0 0 4px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 14px;
    margin-bottom: 24px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: var(--md-sys-color-outline);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--md-sys-color-outline-variant);
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 44px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 22px;
    background: #FFFFFF;
    color: var(--md-sys-color-on-surface);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.google-btn:hover {
    background: var(--md-sys-color-surface-container-low);
}

.google-btn svg {
    width: 18px;
    height: 18px;
}

/* ── Property Selector Grid ── */

.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.property-card {
    display: block;
    background: var(--md-sys-color-surface-container-low);
    border-radius: 12px;
    padding: 20px 24px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, box-shadow 0.15s;
}

.property-card:hover {
    background: var(--md-sys-color-surface-container);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.property-card-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
}

.property-card-address {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 12px;
}

.property-card-add {
    border: 2px dashed var(--md-sys-color-outline-variant);
    text-align: center;
    background: transparent;
}

.property-card-add:hover {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-surface-container-low);
}

.property-card-add .plus {
    font-size: 32px;
    color: var(--md-sys-color-outline);
    margin-bottom: 8px;
}

/* ── Calendar Grid ── */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

.calendar-header {
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.calendar-day {
    min-height: 80px;
    padding: 6px;
    border-right: 1px solid var(--md-sys-color-outline-variant);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    font-size: 12px;
}

.calendar-day:nth-child(7n) { border-right: none; }

.calendar-day.outside {
    background: var(--md-sys-color-surface-container-low);
}

.calendar-day-num {
    font-weight: 500;
    font-size: 13px;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
}

.calendar-day.today { background: #EFF6FF; }
.calendar-day.today .calendar-day-num {
    background: var(--md-sys-color-primary);
    color: #fff;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 12px;
}

.calendar-events { display: flex; flex-direction: column; gap: 2px; }

.calendar-event {
    font-size: 10px;
    font-weight: 500;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

/* OTA channels unified to brand gray; family/owner uses the mint accent. */
/* Per-source colour: a brand-tinted background + a stronger left accent, so Airbnb
   vs Vrbo reads at a glance while text stays dark/legible. Matches the legend dots. */
.calendar-event.airbnb { background: #fdeeee; color: #4d5250; border-left: 3px solid #FF5A5F; }
.calendar-event.booking { background: #e9eff7; color: #4d5250; border-left: 3px solid #003580; }
.calendar-event.vrbo { background: #edf1f8; color: #4d5250; border-left: 3px solid #3B5998; }
.calendar-event.unknown { background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }
.calendar-event.family { background: var(--sm-mint-l5); color: var(--sm-mint-d3); border-left: 3px solid var(--sm-mint); }

.calendar-event.enriched { border-radius: 6px; white-space: normal; line-height: 1.3; }
.calendar-event .event-guest { font-weight: 600; font-size: 10px; }
.calendar-event .event-detail { font-weight: 400; font-size: 9px; opacity: 0.85; }

.calendar-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
}

.calendar-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.calendar-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ── Mobile Cards (responsive reservations) ── */

.mobile-cards {
    display: none;
}

.mobile-card {
    background: var(--md-sys-color-surface-container-low);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.mobile-card-guest {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.mobile-card-code {
    font-size: 12px;
    color: var(--md-sys-color-outline);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

.mobile-card-dates {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    margin: 8px 0;
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    padding: 4px 0;
}

.mobile-card-row.owner-net {
    font-weight: 500;
    color: var(--sm-green-d);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    padding-top: 8px;
    margin-top: 4px;
}

/* ── Calendar Mobile List ── */

.calendar-mobile-list { display: none; }

/* ── Statement (print-optimized) ── */

.statement {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px;
    font-family: 'Roboto', sans-serif;
    color: var(--md-sys-color-on-surface);
}

.statement-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--md-sys-color-on-surface);
}

.statement-header h1 {
    font-size: 24px;
    font-weight: 500;
    margin: 0 0 8px;
}

.statement-header p {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.6;
    margin: 0;
}

.statement-divider {
    border: none;
    border-top: 2px solid var(--md-sys-color-on-surface);
    margin: 24px 0;
}

.statement-total {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    padding: 16px 0;
}

.statement-footer {
    text-align: center;
    font-size: 12px;
    color: var(--md-sys-color-outline);
    padding-top: 24px;
    margin-top: 24px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.divergence-warning {
    background: #FFF3E0;
    color: #E65100;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}

/* ── Expense Summary ── */

.expense-summary { margin-top: 12px; }

.expense-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
}

.expense-line + .expense-line {
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.expense-total {
    font-weight: 500;
    border-top: 2px solid var(--md-sys-color-outline) !important;
    padding-top: 12px;
    margin-top: 4px;
}

/* ── Responsive: Mobile ── */

@media (max-width: 768px) {
    .portal-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 8px;
    }

    .portal-nav-links { order: 3; width: 100%; }
    .portal-nav-property { display: none; }

    .portal-content { padding: 16px 16px 60px; }

    .stat-row.cols-6 { grid-template-columns: repeat(2, 1fr); }
    .stat-row.cols-3 { grid-template-columns: 1fr; }

    .data-table { display: none; }
    .mobile-cards { display: block; }

    .calendar-grid { display: none; }
    .calendar-grid.sm-cal-mobile { display: grid !important; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
    .calendar-grid.sm-cal-mobile .calendar-header { font-size: 9px; padding: 2px 0; }
    .calendar-grid.sm-cal-mobile .calendar-day { min-width: 0; padding: 4px 2px; min-height: 54px; }
    .calendar-grid.sm-cal-mobile .calendar-day-num { font-size: 10px; }
    .calendar-grid.sm-cal-mobile .calendar-event { font-size: 8px; line-height: 1.2; padding: 1px 2px; border-radius: 3px; }
    .calendar-grid.sm-cal-mobile .calendar-event .event-guest,
    .calendar-grid.sm-cal-mobile .calendar-event .event-detail { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .calendar-mobile-list { display: block; }

    /* Month header on mobile: title on its own row; Statements button + Month select share the next row */
    .month-header { flex-wrap: wrap; align-items: center; gap: 12px; }
    .month-header h1 { flex: 1 0 100% !important; }
    .month-header > a { margin-right: 0 !important; }
    .month-header md-outlined-select { flex: 1 1 auto; width: auto !important; min-width: 0; }

    .field-row { grid-template-columns: 1fr; }
    .field-row-3 { grid-template-columns: 1fr; }

    .login-card { width: 100%; padding: 24px 20px; }
    .login-split { flex-direction: column; }
    .login-hero { min-height: 200px; flex: none; }
    .login-form-side { flex: 1; padding: 24px 16px; }
    .login-hero-text { bottom: 20px; left: 20px; right: 20px; }
    .login-hero-text h2 { font-size: 20px; }
}

/* ── Statement Print ── */

@media print {
    .portal-nav,
    .no-print,
    .theme-switcher {
        display: none !important;
    }

    .statement {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .statement-header {
        border-bottom-width: 1px;
    }
}
