/* =====================================================================
   Angel's SMS Portal - portal.css
   Mobile-first, responsive. Cards flow 1 -> 2 -> 3 -> 4 columns as the
   viewport grows. No external framework required.
   ===================================================================== */
:root {
    --brand: #0b5cad;
    --brand-dark: #084a8c;
    --ink: #1f2933;
    --muted: #6b7280;
    --bg: #f4f6f9;
    --card: #ffffff;
    --line: #e3e8ef;
    --star: #f5b301;
    --danger: #c0392b;
    --ok: #1e874b;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }

/* ---------------- Header / chrome ---------------- */
.app-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.app-header-inner {
    display: flex; align-items: center; gap: 12px;
    max-width: 1200px; margin: 0 auto; padding: 10px 16px;
}

.brand-home { display: inline-flex; align-items: center; flex: 0 0 auto; text-decoration: none; }
.brand-home:hover { opacity: .85; }

.brand-logo { width: auto; display: block; }
.brand-logo-full { height: 40px; }
.brand-logo-mini { height: 40px; width: 40px; display: none; }   /* source is 100x100, scaled to fit */

.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-company { font-weight: 700; font-size: 1rem; color: var(--brand-dark); }
.brand-title { font-size: .82rem; color: var(--muted); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.user-chip {
    font-size: .82rem; color: var(--ink); background: #eef2f7;
    padding: 5px 10px; border-radius: 999px; max-width: 40vw;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.btn-home {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px;
    color: var(--ink); background: #fff;
}
.btn-home:hover { background: #f2f4f8; color: var(--brand); }
.btn-home svg { width: 20px; height: 20px; }


.btn-signout {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    max-width: 100px; box-sizing: border-box;
    font-size: .82rem; line-height: 1; border: 1px solid var(--line);
    padding: 7px 12px; border-radius: 8px; color: var(--ink); background: #fff;
    white-space: nowrap; overflow: hidden;
}
.btn-signout:hover { background: #fdecea; color: var(--danger); border-color: #f0c2bd; }

/* Force the icon to a small fixed size regardless of the SVG's viewBox. */
.btn-signout-icon {
    width: 18px !important; height: 18px !important;
    min-width: 18px; min-height: 18px;
    flex: 0 0 auto; display: block;
}
.app-main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.app-footer { text-align: center; color: var(--muted); font-size: .78rem; padding: 24px 16px; }

/* ---------------- Toolbar / search ---------------- */
.menu-toolbar { margin: 4px 0 16px; }
.search-box { position: relative; max-width: 420px; }
.search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: var(--muted);
}
.search-input {
    width: 100%; padding: 11px 14px 11px 38px; border: 1px solid var(--line);
    border-radius: 10px; font-size: .95rem; background: #fff; outline: none;
}
.search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,92,173,.12); }

/* ---------------- Sections ---------------- */
.app-section { margin-bottom: 8px; }
.section-heading {
    font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); margin: 18px 2px 10px;
}
.section-separator { height: 1px; background: var(--line); margin: 18px 0 4px; }
.no-results { color: var(--muted); padding: 24px 4px; }

/* ---------------- Card grid (responsive) ---------------- */
.card-grid {
    display: grid; gap: 14px;
    grid-template-columns: 1fr;                    /* phones: 1 col */
}
@media (min-width: 560px)  { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 860px)  { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1120px) { .card-grid { grid-template-columns: repeat(4, 1fr); } }

.app-card {
    position: relative; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    transition: transform .08s ease, box-shadow .12s ease; overflow: hidden;
}
.app-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16,24,40,.12); }

.card-link { display: flex; gap: 12px; padding: 16px; align-items: flex-start; color: inherit; height: 100%; }
.card-icon {
    flex: 0 0 46px; width: 46px; height: 46px; border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.card-icon img { width: 26px; height: 26px; object-fit: contain; }
.icon-letter { font-size: 1.2rem; }
.card-body { min-width: 0; }
.card-title { margin: 2px 0 4px; font-size: 1rem; }
.card-desc { margin: 0; color: var(--muted); font-size: .85rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Favorite star */
.star {
    position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
    border: none; background: transparent; cursor: pointer; padding: 4px;
    color: #cbd2dc; z-index: 2;
}
.star svg { width: 100%; height: 100%; fill: currentColor; }
.star:hover { color: var(--star); }
.star.on { color: var(--star); }
.star.busy { opacity: .5; pointer-events: none; }

/* ---------------- Panels / forms ---------------- */
.panel {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; max-width: 640px; margin: 8px auto;
}
.panel.center { text-align: center; }
.panel-intro { color: var(--muted); margin-top: 0; }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: .85rem; font-weight: 600; }
.form-control {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 8px; font-size: .95rem;
}
.form-actions { margin-top: 8px; }
.btn-primary {
    background: var(--brand); color: #fff; border: none; padding: 11px 18px;
    border-radius: 8px; font-size: .95rem; cursor: pointer; display: inline-block;
}
.btn-primary:hover { background: var(--brand-dark); }
.result-ok { margin-top: 16px; padding: 12px 14px; border-radius: 8px;
    background: #e8f6ee; color: var(--ok); border: 1px solid #bfe6cd; }
.result-err { margin-top: 16px; padding: 12px 14px; border-radius: 8px;
    background: #fdecea; color: var(--danger); border: 1px solid #f5c6c2; }

.denied-icon svg { width: 56px; height: 56px; color: var(--danger); }

/* ---------------- Login page ---------------- */
.login-body { background: linear-gradient(160deg, #0b5cad 0%, #084a8c 100%); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
    background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
    padding: 32px 28px; width: 100%; max-width: 380px; text-align: center;
}
.login-logo { height: 56px; margin-bottom: 8px; }
.login-title { margin: 4px 0 2px; font-size: 1.35rem; color: var(--brand-dark); }
.login-sub { margin: 0 0 20px; color: var(--muted); }
.btn-oauth {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 12px 14px; margin: 10px 0; border-radius: 10px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font-size: .95rem; font-weight: 600; cursor: pointer;
}
.btn-oauth:hover { background: #f7f9fc; }
.oauth-icon { width: 20px; height: 20px; }
.btn-ms { border-color: #d7dde5; }
.btn-google { border-color: #d7dde5; }
.login-foot { margin-top: 18px; font-size: .78rem; color: var(--muted); }
.login-error {
    background: #fdecea; color: var(--danger); border: 1px solid #f5c6c2;
    border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: .85rem; text-align: left;
}

/* Spinner (callback page) */
.spinner {
    width: 38px; height: 38px; border-radius: 50%; margin: 6px auto 14px;
    border: 4px solid #e3e8ef; border-top-color: var(--brand); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Phone (<= 600px) ---------------- */
@media (max-width: 600px) {
    .brand-logo-full { display: none; }
    .brand-logo-mini { display: block; }

    /* Sign out shows only the icon on phones. */
    .btn-signout { padding: 8px; gap: 0; }
    .btn-signout-text { display: none; }

    /* Give the page title room; hide the user chip on very small screens. */
    .user-chip { display: none; }
}

/* =====================================================================
   Shared components (used by multiple apps)
   ===================================================================== */

/* ---- SelectionBar.ascx ("Selected X: value" context bar) - compact ---- */
.selection-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: #eef2f7; border: 1px solid var(--line); border-radius: 8px;
    padding: 3px 10px; margin: 0 0 10px; line-height: 1.2;
}
.selection-text { font-size: .85rem; }
.selection-caption { color: var(--muted); font-weight: 600; }
.selection-value { font-weight: 700; color: var(--brand-dark); }
.selection-change {
    margin-left: auto;
    padding: 2px 8px; font-size: .72rem; line-height: 1.2; border-radius: 6px;
    background: #fff; color: var(--ink); border: 1px solid var(--line); cursor: pointer;
}
.selection-change:hover { background: #f2f4f8; }

/* ---- Property picker (filterable, favorites-first) ---- */
.picker-panel { max-width: 640px; }
.picker-search { max-width: none; margin-bottom: 12px; }
.picker-heading { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); margin: 10px 2px 6px; }
.picker-separator { height: 1px; background: var(--line); margin: 12px 0 4px; }
.no-results { color: var(--muted); padding: 16px 4px; }

.prop-pick-item { position: relative; display: flex; align-items: center;
    border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: #fff; }
.prop-pick-item:hover { background: #f4f7fb; }
.pick-link { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px;
    padding: 10px 12px; color: inherit; text-decoration: none; }
.pick-name { font-weight: 600; font-size: .95rem; }
.pick-sub { color: var(--muted); font-size: .8rem; }

/* Star toggle */
.prop-pick-item .star { flex: 0 0 auto; width: 38px; height: 38px; padding: 8px;
    margin-right: 4px; border: none; background: transparent; cursor: pointer;
    color: #cbd2dc; display: inline-flex; align-items: center; justify-content: center; }
.prop-pick-item .star svg { width: 100%; height: 100%; fill: currentColor; }
.prop-pick-item .star:hover { color: var(--star, #f5b301); }
.prop-pick-item .star.on { color: var(--star, #f5b301); }
