/* ==========================================================================
   Abba Staff Portal — Front-end UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset inside portal ── */
.asp-wrap, .asp-wrap * {
    box-sizing: border-box;
    font-family: 'Inter', Arial, sans-serif;
}

/* ── Variables ── */
.asp-wrap {
    --asp-blue:    #1B3A6B;
    --asp-blue-lt: #2B5BA8;
    --asp-gold:    #C99383;
    --asp-green:   #2F855A;
    --asp-red:     #C53030;
    --asp-amber:   #B7791F;
    --asp-bg:      #F4F6FA;
    --asp-white:   #FFFFFF;
    --asp-border:  #DDE1E9;
    --asp-text:    #1A202C;
    --asp-muted:   #718096;
    --asp-radius:  10px;
    --asp-shadow:  0 2px 12px rgba(0,0,0,0.08);

    background: var(--asp-bg);
    min-height: 60vh;
    border-radius: var(--asp-radius);
    overflow: hidden;
}

/* ======================================================
   LOGIN
   ====================================================== */
.asp-login-box {
    max-width: 420px;
    margin: 60px auto;
    background: var(--asp-white);
    border-radius: 16px;
    box-shadow: var(--asp-shadow);
    padding: 44px 40px;
}

.asp-login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.asp-login-logo img {
    max-height: 64px;
    width: auto;
    margin-bottom: 12px;
    display: block;
    margin-inline: auto;
}

.asp-login-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.asp-login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--asp-blue);
    margin: 0 0 2px;
}

.asp-login-logo p {
    font-size: 13px;
    color: var(--asp-muted);
    margin: 0;
}

.asp-login-form .asp-field { margin-bottom: 18px; }

/* ======================================================
   TOP BAR
   ====================================================== */
.asp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--asp-blue);
    color: #fff;
    padding: 0 24px;
    height: 58px;
    gap: 12px;
    flex-wrap: wrap;
}

.asp-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.asp-topbar-logo {
    max-height: 36px;
    width: auto;
    display: block;
}

.asp-topbar-brand {
    font-size: 18px;
}

.asp-topbar-title {
    font-size: 14px;
    font-weight: 600;
    opacity: .7;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.asp-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.asp-user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.asp-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.asp-user-name {
    font-size: 14px;
    font-weight: 500;
}

.asp-role-tag {
    background: rgba(255,255,255,.15);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
}

/* ======================================================
   NAV TABS
   ====================================================== */
.asp-nav {
    display: flex;
    background: var(--asp-white);
    border-bottom: 2px solid var(--asp-border);
    padding: 0 16px;
    gap: 4px;
    overflow-x: auto;
}

.asp-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--asp-muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color .2s, border-color .2s;
}

.asp-tab:hover { color: var(--asp-blue); text-decoration: none; }

.asp-tab-active {
    color: var(--asp-blue);
    border-bottom-color: var(--asp-blue);
    font-weight: 600;
}

/* ======================================================
   MAIN CONTENT
   ====================================================== */
.asp-main {
    padding: 24px;
}

.asp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}

.asp-section-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--asp-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.asp-count {
    background: var(--asp-blue);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}

/* ======================================================
   FILTERS
   ====================================================== */
.asp-filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.asp-input-search {
    flex: 1;
    min-width: 200px;
}

/* ======================================================
   TABLE
   ====================================================== */
.asp-table-wrap {
    overflow-x: auto;
    border-radius: var(--asp-radius);
    border: 1px solid var(--asp-border);
    background: var(--asp-white);
}

.asp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.asp-table thead th {
    background: var(--asp-blue);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.asp-table tbody tr { border-bottom: 1px solid var(--asp-border); }
.asp-table tbody tr:last-child { border-bottom: none; }
.asp-table tbody tr:hover { background: #f7f9fc; }
.asp-table tbody td { padding: 12px 16px; vertical-align: middle; }

.asp-ref {
    font-family: monospace;
    font-size: 12px;
    background: #f0f4ff;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--asp-blue);
}

.asp-signer { font-weight: 500; }
.asp-signer-co { font-size: 12px; color: var(--asp-muted); }
.asp-date { font-size: 13px; color: var(--asp-muted); white-space: nowrap; }

.asp-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ======================================================
   STATUS BADGES
   ====================================================== */
.asp-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.asp-status-draft      { background: #EDF2F7; color: #4A5568; }
.asp-status-sent       { background: #EBF4FF; color: #2B6CB0; }
.asp-status-signed     { background: #F0FFF4; color: #276749; }
.asp-status-cancelled  { background: #FFF5F5; color: #C53030; }

/* ======================================================
   BUTTONS
   ====================================================== */
.asp-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all .2s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1;
}

.asp-btn-primary  { background: var(--asp-blue);    color: #fff; }
.asp-btn-primary:hover  { background: var(--asp-blue-lt); color: #fff; text-decoration: none; }
.asp-btn-secondary { background: #EDF2F7; color: var(--asp-text); }
.asp-btn-secondary:hover { background: #E2E8F0; color: var(--asp-text); text-decoration: none; }
.asp-btn-ghost    { background: transparent; color: var(--asp-muted); border: 1px solid var(--asp-border); }
.asp-btn-ghost:hover { border-color: #a0aec0; color: var(--asp-text); text-decoration: none; }
.asp-btn-sm  { padding: 6px 14px; font-size: 13px; }
.asp-btn-xs  { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.asp-btn-lg  { padding: 13px 28px; font-size: 15px; }
.asp-btn-full { width: 100%; justify-content: center; }

/* ======================================================
   INPUTS
   ====================================================== */
.asp-field { display: flex; flex-direction: column; gap: 5px; }
.asp-field label { font-size: 13px; font-weight: 600; color: var(--asp-text); }
.asp-req { color: var(--asp-red); }

.asp-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--asp-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--asp-text);
    background: var(--asp-white);
    transition: border-color .2s;
    line-height: 1.5;
}

.asp-input:focus {
    outline: none;
    border-color: var(--asp-blue);
    box-shadow: 0 0 0 3px rgba(27,58,107,.1);
}

.asp-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23718096' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ======================================================
   FORM GRID
   ====================================================== */
.asp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.asp-field-full { grid-column: 1 / -1; }

.asp-form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--asp-border);
}

/* ======================================================
   TEMPLATE PICKER
   ====================================================== */
.asp-template-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.asp-tpl-btn {
    padding: 8px 18px;
    border-radius: 20px;
    border: 2px solid var(--asp-border);
    background: var(--asp-white);
    color: var(--asp-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all .2s;
}

.asp-tpl-btn:hover     { border-color: var(--asp-blue); color: var(--asp-blue); text-decoration: none; }
.asp-tpl-active        { border-color: var(--asp-blue); background: var(--asp-blue); color: #fff; }
.asp-tpl-active:hover  { color: #fff; }

/* ======================================================
   ALERTS
   ====================================================== */
.asp-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.asp-alert-error   { background: #FFF5F5; color: #C53030; border: 1px solid #FEB2B2; }
.asp-alert-success { background: #F0FFF4; color: #276749; border: 1px solid #9AE6B4; }
.asp-alert-info    { background: #EBF8FF; color: #2B6CB0; border: 1px solid #90CDF4; }

/* ======================================================
   EMPTY STATE
   ====================================================== */
.asp-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--asp-muted);
    font-size: 15px;
    background: var(--asp-white);
    border-radius: var(--asp-radius);
    border: 1px dashed var(--asp-border);
}

.asp-empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ======================================================
   PAGINATION
   ====================================================== */
.asp-pagination {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.asp-page-btn {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1.5px solid var(--asp-border);
    color: var(--asp-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all .15s;
}

.asp-page-btn:hover { border-color: var(--asp-blue); color: var(--asp-blue); }
.asp-page-active    { background: var(--asp-blue); border-color: var(--asp-blue); color: #fff; }
.asp-page-active:hover { color: #fff; }

/* ======================================================
   MODAL
   ====================================================== */
.asp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
}

.asp-modal {
    background: var(--asp-white);
    border-radius: 16px;
    width: 100%;
    max-width: 780px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.asp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--asp-border);
    flex-shrink: 0;
}

.asp-modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--asp-text);
    margin: 0;
}

.asp-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--asp-muted);
    padding: 4px 8px;
    border-radius: 6px;
    transition: background .2s;
    line-height: 1;
}

.asp-modal-close:hover { background: #f0f0f0; }

.asp-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.asp-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--asp-border);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    background: #fafbfc;
    border-radius: 0 0 16px 16px;
}

/* Detail view inside modal */
.asp-view-detail { font-size: 14px; }
.asp-detail-row  { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.asp-detail-row:last-of-type { border: none; }
.asp-detail-label { font-weight: 600; color: var(--asp-muted); min-width: 120px; flex-shrink: 0; font-size: 13px; }
.asp-detail-val   { color: var(--asp-text); word-break: break-word; }

.asp-detail-link .asp-detail-val { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.asp-link-input  { font-size: 12px; font-family: monospace; flex: 1; min-width: 200px; }

.asp-detail-document { margin-top: 20px; }
.asp-detail-doc-label { font-size: 12px; font-weight: 700; color: var(--asp-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.asp-rendered-html { border: 1px solid var(--asp-border); border-radius: 8px; padding: 20px; background: #fff; font-size: 13px; }

/* ======================================================
   HOUSEKEEPING
   ====================================================== */
.asp-hk-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.asp-hk-pill {
    flex: 1;
    min-width: 100px;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

.asp-hk-num { display: block; font-size: 28px; font-weight: 800; margin-bottom: 2px; }

.asp-hk-clean       { background: #F0FFF4; color: #276749; }
.asp-hk-dirty       { background: #FFF5F5; color: #C53030; }
.asp-hk-progress    { background: #FFFBEB; color: #B7791F; }
.asp-hk-maintenance { background: #EBF8FF; color: #2B6CB0; }

.asp-hk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
}

.asp-room-card {
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    font-size: 12px;
    border: 2px solid transparent;
    transition: transform .15s;
}

.asp-room-card:hover { transform: translateY(-2px); }

.asp-room-clean       { background: #F0FFF4; border-color: #9AE6B4; }
.asp-room-dirty       { background: #FFF5F5; border-color: #FEB2B2; }
.asp-room-in_progress { background: #FFFBEB; border-color: #FAF089; }
.asp-room-maintenance { background: #EBF8FF; border-color: #90CDF4; }

.asp-room-num    { font-size: 20px; font-weight: 800; margin-bottom: 3px; }
.asp-room-status { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.asp-room-type   { font-size: 10px; color: var(--asp-muted); margin-top: 2px; }
.asp-room-occ    { font-size: 10px; margin-top: 3px; }
.asp-room-notes  { font-size: 14px; margin-top: 4px; cursor: help; }

.asp-hk-coming-soon {
    text-align: center;
    padding: 60px 24px;
    background: var(--asp-white);
    border-radius: var(--asp-radius);
    border: 1px dashed var(--asp-border);
}

/* ======================================================
   RESPONSIVE
   ====================================================== */
@media (max-width: 640px) {
    .asp-topbar       { height: auto; padding: 12px 16px; }
    .asp-main         { padding: 16px; }
    .asp-form-grid    { grid-template-columns: 1fr; }
    .asp-table thead  { display: none; }
    .asp-table tbody tr { display: block; padding: 12px; border-bottom: 2px solid var(--asp-border); }
    .asp-table tbody td { display: flex; justify-content: space-between; padding: 4px 0; border: none; }
    .asp-table tbody td::before { content: attr(data-label); font-weight: 600; color: var(--asp-muted); font-size: 12px; }
    .asp-login-box    { margin: 20px auto; padding: 28px 20px; }
    .asp-modal        { margin: 0; border-radius: 12px 12px 0 0; }
    .asp-modal-overlay { align-items: flex-end; padding: 0; }
}
