/* =========================================================
   Habito Owner Portal — Stylesheet
   Designed to complement habito.net.au (WordPress/Elementor)
   ========================================================= */

:root {
    --hp-primary:    #2E7D9E;
    --hp-primary-dk: #1a5f7a;
    --hp-accent:     #00BFA5;
    --hp-danger:     #e53935;
    --hp-success:    #43a047;
    --hp-warn:       #fb8c00;
    --hp-bg:         #F5F7FA;
    --hp-surface:    #ffffff;
    --hp-border:     #e1e8ed;
    --hp-text:       #1a2332;
    --hp-muted:      #6b7a8d;
    --hp-sidebar-w:  260px;
    --hp-radius:     10px;
    --hp-shadow:     0 2px 12px rgba(0,0,0,.08);
}

/* ---- Reset / scope ---- */
.habito-portal-wrap *,
.habito-portal-wrap *::before,
.habito-portal-wrap *::after {
    box-sizing: border-box;
}

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.habito-login-wrap {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hp-bg);
    padding: 40px 16px;
}

.habito-login-card {
    background: var(--hp-surface);
    border-radius: var(--hp-radius);
    box-shadow: var(--hp-shadow);
    padding: 48px 40px 40px;
    width: 100%;
    max-width: 420px;
}

.habito-login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.habito-login-logo img {
    height: 52px;
    width: auto;
}
.habito-login-brand {
    font-size: 28px;
    font-weight: 800;
    color: var(--hp-primary);
    letter-spacing: -0.5px;
}

.habito-login-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--hp-text);
    text-align: center;
    margin: 0 0 6px;
}
.habito-login-subtitle {
    font-size: 14px;
    color: var(--hp-muted);
    text-align: center;
    margin: 0 0 28px;
}

/* ---- Fields ---- */
.habito-field {
    margin-bottom: 18px;
}
.habito-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--hp-text);
    margin-bottom: 6px;
}
.habito-field input[type="text"],
.habito-field input[type="password"],
.habito-field input[type="email"] {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--hp-border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--hp-text);
    background: var(--hp-surface);
    transition: border-color .2s;
    outline: none;
}
.habito-field input:focus {
    border-color: var(--hp-primary);
    box-shadow: 0 0 0 3px rgba(46,125,158,.12);
}
.habito-password-wrap {
    position: relative;
}
.habito-password-wrap input {
    padding-right: 44px;
}
.habito-toggle-pass {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--hp-muted);
    padding: 0;
}

.habito-field-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.habito-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--hp-muted);
    cursor: pointer;
}
.habito-forgot {
    font-size: 13px;
    color: var(--hp-primary);
    text-decoration: none;
}
.habito-forgot:hover { text-decoration: underline; }

.habito-login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--hp-muted);
}
.habito-login-footer a {
    color: var(--hp-primary);
    text-decoration: none;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.habito-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .2s, opacity .2s, transform .1s;
    line-height: 1;
}
.habito-btn:active { transform: scale(.98); }
.habito-btn-primary {
    background: var(--hp-primary);
    color: #fff;
}
.habito-btn-primary:hover { background: var(--hp-primary-dk); color: #fff; }
.habito-btn-outline {
    background: transparent;
    color: var(--hp-primary);
    border: 1.5px solid var(--hp-primary);
}
.habito-btn-outline:hover { background: var(--hp-primary); color: #fff; }
.habito-btn-ghost {
    background: transparent;
    color: var(--hp-muted);
    border: 1.5px solid var(--hp-border);
}
.habito-btn-ghost:hover { background: var(--hp-bg); color: var(--hp-text); }
.habito-btn-danger {
    background: var(--hp-danger);
    color: #fff;
}
.habito-btn-danger:hover { opacity: .9; }
.habito-btn-full { width: 100%; justify-content: center; }
.habito-btn-sm { padding: 7px 14px; font-size: 13px; }
.habito-btn[disabled] { opacity: .6; cursor: not-allowed; }

.btn-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hp-spin .7s linear infinite;
    display: inline-block;
}
@keyframes hp-spin { to { transform: rotate(360deg); } }

/* =========================================================
   ALERTS
   ========================================================= */
.habito-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    border-left: 4px solid transparent;
}
.habito-alert-error   { background: #fdecea; border-color: var(--hp-danger);  color: #b71c1c; }
.habito-alert-success { background: #e8f5e9; border-color: var(--hp-success); color: #1b5e20; }
.habito-alert-info    { background: #e3f2fd; border-color: var(--hp-primary); color: #0d47a1; }

/* =========================================================
   DASHBOARD LAYOUT
   ========================================================= */
.habito-dash-wrap {
    display: flex;
    min-height: 100vh;
    background: var(--hp-bg);
}

/* ---- Sidebar ---- */
.habito-sidebar {
    width: var(--hp-sidebar-w);
    flex-shrink: 0;
    background: var(--hp-surface);
    border-right: 1px solid var(--hp-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.habito-sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--hp-border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.habito-user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--hp-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px;
    flex-shrink: 0;
}
.habito-user-info {
    display: flex; flex-direction: column;
    overflow: hidden;
}
.habito-user-info strong {
    font-size: 14px; color: var(--hp-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.habito-user-info span { font-size: 12px; color: var(--hp-muted); }

.habito-sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.habito-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--hp-muted);
    text-decoration: none;
    transition: background .15s, color .15s;
    position: relative;
}
.habito-nav-item:hover {
    background: var(--hp-bg);
    color: var(--hp-text);
}
.habito-nav-item.active {
    background: rgba(46,125,158,.1);
    color: var(--hp-primary);
    font-weight: 600;
}
.habito-nav-item .dashicons {
    font-size: 18px; width: 18px; height: 18px;
}

.habito-sidebar-footer {
    padding: 16px 10px;
    border-top: 1px solid var(--hp-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---- Main ---- */
.habito-main {
    flex: 1;
    min-width: 0;
    padding: 32px;
    overflow-x: auto;
}
.habito-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.habito-page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--hp-text);
    margin: 0;
}

/* =========================================================
   NAV HEADER INJECTION (Owner Login button in site nav)
   ========================================================= */
.habito-nav-login a.habito-nav-btn,
li.habito-nav-login a {
    background: var(--hp-primary);
    color: #fff !important;
    padding: 7px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background .2s;
}
li.habito-nav-login a:hover,
.habito-nav-login a.habito-nav-btn:hover {
    background: var(--hp-primary-dk);
}

/* =========================================================
   BADGES & STATUS
   ========================================================= */
.habito-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--hp-danger);
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    margin-left: auto;
}

.habito-platform-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
}
.habito-platform-badge.sm { font-size: 10px; padding: 2px 6px; }

.habito-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.habito-status-confirmed { background: #e8f5e9; color: #2e7d32; }
.habito-status-pending   { background: #fff3e0; color: #e65100; }
.habito-status-cancelled { background: #fce4ec; color: #880e4f; }
.habito-status-completed { background: #e3f2fd; color: #0d47a1; }

/* =========================================================
   EMPTY STATE
   ========================================================= */
.habito-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--hp-muted);
}
.habito-empty-icon {
    font-size: 48px !important;
    width: 48px !important;
    height: 48px !important;
    color: var(--hp-border);
    display: block;
    margin: 0 auto 16px;
}
.habito-empty-state h3 {
    font-size: 18px;
    color: var(--hp-text);
    margin: 0 0 8px;
}
.habito-empty-state p { margin: 0; font-size: 14px; }
.habito-empty-state a { color: var(--hp-primary); }

/* =========================================================
   LISTINGS
   ========================================================= */
.habito-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.habito-listing-card {
    background: var(--hp-surface);
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius);
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: box-shadow .2s;
}
.habito-listing-card:hover { box-shadow: var(--hp-shadow); }
.habito-listing-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    background: rgba(46,125,158,.1);
    color: var(--hp-primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.habito-listing-icon .dashicons { font-size: 22px; }
.habito-listing-info { flex: 1; min-width: 0; }
.habito-listing-info h3 { font-size: 15px; margin: 0 0 4px; color: var(--hp-text); }
.habito-listing-address { font-size: 13px; color: var(--hp-muted); margin: 0 0 10px; }
.habito-platform-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.habito-listing-actions { display: flex; align-items: center; }

/* =========================================================
   TABLES
   ========================================================= */
.habito-table-wrap { overflow-x: auto; }
.habito-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.habito-table th,
.habito-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--hp-border);
    white-space: nowrap;
}
.habito-table th {
    font-weight: 600;
    color: var(--hp-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--hp-bg);
}
.habito-table tbody tr:hover { background: var(--hp-bg); }
.habito-amount { font-weight: 600; color: var(--hp-text); }

/* =========================================================
   MESSAGES
   ========================================================= */
.habito-messages-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    background: var(--hp-surface);
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius);
    overflow: hidden;
    min-height: 500px;
}
.habito-thread-list {
    border-right: 1px solid var(--hp-border);
    overflow-y: auto;
}
.habito-thread-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--hp-border);
    transition: background .15s;
}
.habito-thread-item:hover { background: var(--hp-bg); }
.habito-thread-item.active { background: rgba(46,125,158,.08); }
.habito-thread-item.unread .habito-thread-info strong { color: var(--hp-text); }
.habito-thread-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--hp-accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    flex-shrink: 0;
}
.habito-thread-info { flex: 1; min-width: 0; }
.habito-thread-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}
.habito-thread-meta strong { font-size: 13px; color: var(--hp-text); }
.habito-thread-meta time { font-size: 11px; color: var(--hp-muted); margin-left: auto; }
.habito-thread-preview { font-size: 12px; color: var(--hp-muted); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.habito-thread-detail { display: flex; flex-direction: column; }
.habito-thread-empty {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--hp-muted); font-size: 14px; gap: 8px;
}
.habito-thread-empty .dashicons { font-size: 36px; color: var(--hp-border); }

.habito-thread-messages { display: flex; flex-direction: column; height: 100%; }
.habito-thread-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--hp-border);
    display: flex; align-items: center; gap: 12px;
}
.habito-thread-header strong { font-size: 15px; color: var(--hp-text); }
.habito-thread-prop { font-size: 13px; color: var(--hp-muted); }
.habito-messages-scroll {
    flex: 1; overflow-y: auto;
    padding: 16px 20px;
    display: flex; flex-direction: column; gap: 12px;
}
.habito-message { display: flex; flex-direction: column; max-width: 75%; }
.habito-message-guest  { align-self: flex-start; }
.habito-message-owner  { align-self: flex-end; }
.habito-message-habito { align-self: center; }
.habito-message-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
}
.habito-message-guest  .habito-message-bubble { background: var(--hp-bg);  color: var(--hp-text); border-bottom-left-radius: 4px; }
.habito-message-owner  .habito-message-bubble { background: var(--hp-primary); color: #fff; border-bottom-right-radius: 4px; }
.habito-message-habito .habito-message-bubble { background: rgba(0,191,165,.1); color: var(--hp-text); border-radius: 10px; font-style: italic; }
.habito-message-time { font-size: 11px; color: var(--hp-muted); margin-top: 4px; }
.habito-message-owner .habito-message-time { text-align: right; }

/* =========================================================
   EARNINGS / STATS
   ========================================================= */
.habito-stats-row {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.habito-stat-card {
    flex: 1;
    min-width: 160px;
    background: var(--hp-surface);
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.habito-stat-label { font-size: 12px; color: var(--hp-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.habito-stat-value { font-size: 28px; font-weight: 800; color: var(--hp-primary); }

/* =========================================================
   INSIGHTS
   ========================================================= */
.habito-insights-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.habito-insight-panel {
    background: var(--hp-surface);
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius);
    padding: 20px;
}
.habito-insight-panel h3 { font-size: 15px; margin: 0 0 16px; color: var(--hp-text); }

.habito-platform-stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.habito-stat-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--hp-bg);
    border-radius: 4px;
    overflow: hidden;
}
.habito-stat-bar {
    height: 100%;
    border-radius: 4px;
    transition: width .5s ease;
}
.habito-stat-count { font-size: 12px; color: var(--hp-muted); white-space: nowrap; }

/* =========================================================
   CONNECTIONS
   ========================================================= */
.habito-connections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.habito-connection-card {
    background: var(--hp-surface);
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius);
    overflow: hidden;
    transition: box-shadow .2s;
}
.habito-connection-card:hover { box-shadow: var(--hp-shadow); }
.habito-connection-card.connected { border-color: var(--hp-success); }
.habito-connection-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--hp-bg);
}
.habito-connection-icon { font-size: 28px; }
.habito-connection-header h3 { font-size: 15px; margin: 0 0 4px; color: var(--hp-text); }
.habito-connected-badge    { font-size: 11px; background: #e8f5e9; color: #2e7d32; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.habito-disconnected-badge { font-size: 11px; background: var(--hp-bg); color: var(--hp-muted); padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.habito-connection-body {
    padding: 16px;
    font-size: 13px;
    color: var(--hp-muted);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.habito-connection-note { font-size: 12px; color: var(--hp-muted); font-style: italic; }

/* =========================================================
   SECTION TITLE / INTRO
   ========================================================= */
.habito-section-title { font-size: 16px; color: var(--hp-text); margin: 0 0 16px; font-weight: 600; }
.habito-section-intro { font-size: 14px; color: var(--hp-muted); margin-bottom: 24px; }

/* =========================================================
   CALENDAR WRAPPER
   ========================================================= */
.habito-calendar-wrap {
    background: var(--hp-surface);
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius);
    padding: 20px;
    margin-bottom: 28px;
}
.habito-bookings-list { margin-top: 8px; }

/* =========================================================
   SYNC STATUS
   ========================================================= */
#habito-sync-status {
    font-size: 13px;
    color: var(--hp-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
#habito-sync-status.syncing { color: var(--hp-primary); }
#habito-sync-status.done    { color: var(--hp-success); }
#habito-sync-status.error   { color: var(--hp-danger); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
    .habito-insights-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .habito-dash-wrap { flex-direction: column; }
    .habito-sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--hp-border);
    }
    .habito-sidebar-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding: 8px; }
    .habito-nav-item { white-space: nowrap; }
    .habito-main { padding: 20px 16px; }
    .habito-messages-layout { grid-template-columns: 1fr; }
    .habito-thread-list { border-right: none; border-bottom: 1px solid var(--hp-border); max-height: 250px; }
    .habito-stats-row { gap: 12px; }
    .habito-stat-value { font-size: 22px; }
}
@media (max-width: 480px) {
    .habito-login-card { padding: 32px 20px; }
    .habito-listings-grid { grid-template-columns: 1fr; }
    .habito-connections-grid { grid-template-columns: 1fr; }
}
