/* =========================================================================
   public-refresh.css — Public-site UI refresh (Phase 1: foundation)
   Overrides Bootstrap 4 + Inspinia defaults via custom properties and a
   small set of targeted selectors. Loaded last in _Public.cshtml so it wins.
   ========================================================================= */

/* --- Inter (variable font, self-hosted) ---------------------------------- */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter/InterVariable.woff2') format('woff2-variations'),
         url('../fonts/inter/InterVariable.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter/InterVariable-Italic.woff2') format('woff2-variations'),
         url('../fonts/inter/InterVariable-Italic.woff2') format('woff2');
}

/* --- Design tokens -------------------------------------------------------- */
/* --primary / --secondary / --tertiary come from Menu/StyleRoot.cshtml,
   which serves the per-tenant theme set in /SystemSettings.
   Brand vars below derive from those so the admin theme picker keeps working;
   fallbacks render correctly if StyleRoot isn't loaded for some reason. */
:root {
    --brand-primary: var(--primary, #0e7c66);
    --brand-primary-hover: var(--tertiary, #0a6353);
    --brand-primary-soft: color-mix(in srgb, var(--primary, #0e7c66) 12%, transparent);
    --surface: #ffffff;
    --surface-muted: #f4f6f8;
    --text-primary: #1f2937;
    --text-muted: #64748b;
    --border-soft: #e5e7eb;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);
}

/* --- Body typography ----------------------------------------------------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Replaces the inline <style> small{font-size:12px!important} hack */
small,
.small {
    font-size: 0.8125rem;
}

/* --- Surfaces ------------------------------------------------------------ */
.gray-bg {
    background-color: var(--surface-muted) !important;
}

.ibox {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-soft);
}

.ibox-content {
    border: none;
}

.ibox-title {
    border-color: var(--border-soft);
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
}

.btn-outline-primary {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-outline-primary:hover {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* --- Badges -------------------------------------------------------------- */
.badge,
.label {
    border-radius: var(--radius-md);
    padding: 4px 10px;
    font-weight: 500;
    transition: all 0.15s ease;
}

/* --- Forms --------------------------------------------------------------- */
.form-control {
    border-radius: var(--radius-md);
    border-color: var(--border-soft);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-soft);
}

/* --- Links --------------------------------------------------------------- */
a {
    color: var(--brand-primary);
}

a:hover,
a:focus {
    color: var(--brand-primary-hover);
}

/* --- Misc page-level ---------------------------------------------------- */
html {
    scroll-behavior: smooth;
}

/* =========================================================================
   Phase 2 — Page heading band + homepage hero
   ========================================================================= */

/* --- Page heading band -------------------------------------------------- */
.page-header-band {
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    padding: 1.5rem 0;
}

.page-header-band .breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.page-header-band .breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
}

.page-header-band .breadcrumb-item a:hover {
    color: var(--brand-primary);
}

.page-header-band .breadcrumb-item.active {
    color: var(--text-muted);
}

.page-header-band .page-title {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0;
}

.page-header-band p {
    color: var(--text-muted);
    margin: 0.5rem 0 0;
    font-size: 0.95rem;
    max-width: 720px;
}

/* --- Homepage hero ------------------------------------------------------ */
.public-hero {
    background: linear-gradient(135deg,
        var(--brand-primary) 0%,
        color-mix(in srgb, var(--brand-primary) 60%, #ffffff) 100%);
    color: #fff;
    padding: 3.5rem 2.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.public-hero .hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.75rem;
    line-height: 1.15;
}

.public-hero .hero-subtitle {
    font-size: 1.125rem;
    opacity: 0.94;
    margin: 0 0 1.5rem;
    max-width: 720px;
    line-height: 1.55;
}

.public-hero .hero-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.public-hero .hero-actions .btn-light {
    background: #fff;
    border-color: #fff;
    color: var(--brand-primary);
    font-weight: 600;
}

.public-hero .hero-actions .btn-light:hover,
.public-hero .hero-actions .btn-light:focus {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.92);
    color: var(--brand-primary);
}

.public-hero .hero-actions .btn-outline-light {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
}

.public-hero .hero-actions .btn-outline-light:hover,
.public-hero .hero-actions .btn-outline-light:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: #fff;
    color: #fff;
}

@media (max-width: 768px) {
    .public-hero {
        padding: 2rem 1.25rem;
    }

    .public-hero .hero-title {
        font-size: 1.75rem;
    }

    .public-hero .hero-subtitle {
        font-size: 1rem;
    }

    .page-header-band .page-title {
        font-size: 1.5rem;
    }
}

/* =========================================================================
   Phase 3 — Cards & grids polish
   ========================================================================= */

/* --- Legislator card ---------------------------------------------------- */
.legislator-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.legislator-card:hover,
.legislator-card:focus {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--brand-primary) 35%, var(--border-soft));
    text-decoration: none;
    color: inherit;
}

.legislator-card .photo {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    background: var(--surface-muted);
    margin-bottom: 0.875rem;
}

.legislator-card .photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.legislator-card .initials-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.02em;
}

.legislator-card .position-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: var(--brand-primary);
    color: #fff;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.legislator-card .name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.4rem;
    line-height: 1.3;
}

.legislator-card .address {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
}

.legislator-card .address .fa {
    color: var(--brand-primary);
    margin-right: 4px;
}

.legislator-card .bio {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 0.5rem;
}

.legislator-card .read-more {
    color: var(--brand-primary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* --- Empty-state cards (lists with no records) -------------------------- */
.empty-state-card {
    background: var(--surface);
    border: 1px dashed var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-card .fa {
    font-size: 2.5rem;
    color: var(--border-soft);
    margin-bottom: 1rem;
    display: block;
}

.empty-state-card h3 {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.empty-state-card p {
    margin: 0;
    font-size: 0.95rem;
}

/* --- DataTable empty state container ------------------------------------ */
.dataTables td .empty-state {
    padding: 2.5rem 1rem !important;
}

/* --- ProposedMeasure number tag ----------------------------------------- */
.pm-number-tag {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.1;
    gap: 2px;
}

.pm-number-tag .type {
    font-size: 0.625rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    font-weight: 600;
}

.pm-number-tag .num {
    font-size: 0.95rem;
    color: var(--brand-primary);
    font-weight: 600;
}

/* --- ProposedMeasure action buttons (icon-only, lighter weight) --------- */
.pm-actions {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-muted);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.btn-icon:hover,
.btn-icon:focus {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
    transform: translateY(-1px);
}

.btn-icon .fa {
    font-size: 0.95rem;
}

/* --- DataTable row hover (subtle brand tint) ---------------------------- */
table.dataTable tbody tr:hover {
    background: color-mix(in srgb, var(--brand-primary) 4%, transparent);
}

/* --- Search results highlight + hover ----------------------------------- */
.search-result {
    cursor: pointer;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    transition: background-color 0.15s ease;
}

.search-result:hover {
    background: var(--surface-muted);
}

.search-result h3 {
    margin-top: 0;
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
}

.search-result mark,
mark {
    background: color-mix(in srgb, var(--brand-primary) 18%, transparent);
    color: inherit;
    padding: 1px 3px;
    border-radius: 3px;
}

/* --- Widget zero-state copy --------------------------------------------- */
.widget-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.5rem 0 0;
}

.widget-empty a {
    color: var(--brand-primary);
    font-weight: 500;
}

.widget-show-more {
    color: var(--brand-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

.widget-show-more:hover {
    text-decoration: underline;
}

/* =========================================================================
   Phase 4 — Detail pages
   ========================================================================= */

/* --- Back link (used on detail pages) ----------------------------------- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s ease;
}

.back-link:hover,
.back-link:focus {
    color: var(--brand-primary);
    text-decoration: none;
}

.back-link .fa {
    font-size: 0.8rem;
}

/* --- Legislator detail layout ------------------------------------------- */
.legislator-detail-photo {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.legislator-detail-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.legislator-detail-bio {
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0 0 1rem;
}

.legislator-contact li {
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 6px;
    line-height: 1.4;
}

.legislator-contact li .fa {
    color: var(--brand-primary);
    width: 18px;
    margin-right: 6px;
}

.legislator-contact li a {
    color: var(--brand-primary);
}

.legislator-contact li a:hover {
    text-decoration: underline;
}

/* --- Info strip (stats below the legislator name) ----------------------- */
.info-strip {
    display: flex;
    gap: 2.5rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    margin: 1.5rem 0;
}

.info-strip .stat {
    text-align: left;
}

.info-strip .stat .number {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--brand-primary);
    line-height: 1;
}

.info-strip .stat .label {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
    padding: 0;
}

/* --- ProposedMeasure status badges (colored by meaning) ----------------- */
.label.pm-status-badge {
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    color: #fff !important;
}

.label.pm-status-badge.type-badge {
    background: color-mix(in srgb, var(--brand-primary) 70%, #ffffff);
}

.label.pm-status-badge.status-draft {
    background: #6b7280;
}

.label.pm-status-badge.status-pending {
    background: #f59e0b;
}

.label.pm-status-badge.status-approved {
    background: #16a34a;
}

.label.pm-status-badge.status-rejected {
    background: #dc2626;
}

/* --- ProposedMeasure author sidebar ------------------------------------- */
.author-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.author-card:hover,
.author-card:focus {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
}

.author-card-header {
    background: var(--brand-primary);
    color: #fff;
    text-align: center;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.author-card-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.author-card-body {
    padding: 0.875rem;
}

.author-card-body strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.author-card-body p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.author-card-body p .fa {
    color: var(--brand-primary);
    margin-right: 4px;
}

.author-card--text .author-card-body {
    text-align: center;
    padding: 1.25rem 0.875rem;
}

/* Sponsorship note shown when a measure has no individual author */
.sponsorship-note {
    background: var(--surface-muted);
    border: 1px dashed var(--border-soft);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}

.sponsorship-note small {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.sponsorship-note strong {
    color: var(--text-primary);
    font-size: 1rem;
}

/* --- FullCalendar today highlight --------------------------------------- */
.fc .fc-day-today,
.fc-day-today {
    background: color-mix(in srgb, var(--brand-primary) 8%, transparent) !important;
    box-shadow: inset 0 0 0 2px var(--brand-primary);
}

.fc .fc-button-primary {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.fc .fc-button-primary:not(:disabled):hover,
.fc .fc-button-primary:not(:disabled):focus {
    background-color: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
}

/* =========================================================================
   Phase 5 — Micro-polish (toast, page fade, sidebar drawer, processing tint)
   ========================================================================= */

/* --- Soft page fade-in (replaces Inspinia's animated fadeInRight) ------- */
@keyframes pageFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.page-fade-in {
    animation: pageFadeIn 0.25s ease-out;
}

/* --- Custom toast (used by ProposedMeasure share button) ---------------- */
.custom-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text-primary);
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 1080;
    font-size: 0.9rem;
}

.custom-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* --- DataTable processing indicator (brand-tinted, less spinner-y) ------ */
.dataTables_processing {
    background: rgba(255, 255, 255, 0.85) !important;
    color: var(--brand-primary) !important;
    border: 1px solid var(--border-soft) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-sm) !important;
}

.dataTables_processing .fa-spinner {
    color: var(--brand-primary);
}

/* --- Off-canvas sidebar backdrop (Inspinia canvas-menu mode) ------------ */
.canvas-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 998;
}

body.mini-navbar .canvas-backdrop {
    opacity: 1;
    pointer-events: auto;
}

body.canvas-menu .navbar-default,
body.canvas-menu nav.navbar-default {
    transition: transform 0.25s ease;
}

/* =========================================================================
   Phase 6 — Footer refresh
   Brand-tracked dark footer (color-mix keeps the admin theme picker live)
   with a soft wave divider above and a 3-column link grid.
   ========================================================================= */

.public-footer {
    --footer-bg: color-mix(in srgb, var(--brand-primary) 22%, #111827);
    --footer-text: #cbd5e1;
    --footer-text-strong: #ffffff;

    position: relative;
    background: var(--footer-bg);
    color: var(--footer-text);
    margin-top: 4rem;
    padding-top: 2.5rem;
    padding-bottom: 0;
}

/* Wave divider sits above the footer and pulls up so the body content
   transitions into the footer with a soft curve instead of a flat line. */
.public-footer-wave {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 50px;
    transform: translateY(-100%);
    display: block;
    color: var(--footer-bg);
}

.public-footer-wave path {
    fill: currentColor;
}

.public-footer-inner {
    padding: 1.5rem 4.5rem 2rem;
}

.public-footer-desc {
    color: var(--footer-text);
    line-height: 1.55;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

/* --- Footer headings + link columns ------------------------------------- */
.footer-heading {
    color: var(--footer-text-strong);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.footer-heading .fa {
    margin-right: 6px;
    opacity: 0.7;
}

.footer-links li {
    padding: 4px 0;
    font-size: 0.9rem;
}

.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-links a:hover,
.footer-links a:focus {
    color: var(--footer-text-strong);
}

/* --- Footer contact list (address, phone, email) ------------------------ */
.footer-contact li {
    padding: 4px 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.footer-contact li .fa {
    color: color-mix(in srgb, var(--brand-primary) 70%, #ffffff);
    width: 18px;
    margin-right: 6px;
}

.footer-contact a {
    color: var(--footer-text);
    text-decoration: none;
}

.footer-contact a:hover,
.footer-contact a:focus {
    color: var(--footer-text-strong);
    text-decoration: underline;
}

/* --- Social row --------------------------------------------------------- */
.public-footer-social li {
    margin-right: 14px;
}

.public-footer-social a {
    color: var(--footer-text);
    font-size: 1.25rem;
    transition: color 0.15s ease;
}

.public-footer-social a:hover,
.public-footer-social a:focus {
    color: var(--footer-text-strong);
}

/* --- Bottom meta strip -------------------------------------------------- */
.public-footer-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 14px 4.5rem;
    font-size: 0.825rem;
    color: var(--footer-text);
}

.public-footer-meta a {
    color: var(--footer-text-strong);
    text-decoration: none;
}

.public-footer-meta a:hover,
.public-footer-meta a:focus {
    text-decoration: underline;
}

/* --- Mobile collapse ---------------------------------------------------- */
@media (max-width: 768px) {
    .public-footer-inner {
        padding: 1.5rem 1.5rem 1rem;
    }

    .public-footer-meta {
        padding: 12px 1.5rem;
        flex-direction: column;
        text-align: center;
    }
}
