/* =====================================================================
   AI Front Desk — portal design system
   Overrides Bootstrap's own CSS custom properties (loaded before this
   file — see layout_top.php) rather than fighting them with !important
   everywhere. Bootstrap 5.3 themes itself off these variables, so
   redefining them here re-skins buttons, badges (text-bg-*), links, and
   form focus states across every page automatically, with no per-page
   markup changes needed.

   Deliberately no illustrations/decorative graphics — for an admin
   console, a confident color system + purposeful icon use (Bootstrap
   Icons, already loaded) + real depth (shadows, borders) reads as more
   professional than illustration, and doesn't carry an ongoing asset-
   maintenance burden.
   ===================================================================== */

:root {
    /* Core palette — a deliberate indigo rather than Bootstrap's
       default blue, so the product doesn't read as "unstyled
       Bootstrap." Semantic colors (success/danger/warning/info) are
       refined shades rather than the stock ones, for the same reason. */
    --bs-primary: #4a5fe8;
    --bs-primary-rgb: 74, 95, 232;
    --bs-primary-text-emphasis: #3444b0;
    --bs-primary-bg-subtle: #e8eaff;
    --bs-primary-border-subtle: #c7ccf9;
    --bs-link-color: #4a5fe8;
    --bs-link-color-rgb: 74, 95, 232;
    --bs-link-hover-color: #3444b0;

    --bs-success: #17a06a;
    --bs-success-rgb: 23, 160, 106;
    --bs-success-bg-subtle: #d9f4e9;
    --bs-success-border-subtle: #a6e6cb;

    --bs-danger: #e0393e;
    --bs-danger-rgb: 224, 57, 62;
    --bs-danger-bg-subtle: #fce1e2;
    --bs-danger-border-subtle: #f6b7b9;

    --bs-warning: #dc8a1f;
    --bs-warning-rgb: 220, 138, 31;
    --bs-warning-bg-subtle: #fbebd4;
    --bs-warning-border-subtle: #f2d29d;

    --bs-info: #0e93a8;
    --bs-info-rgb: 14, 147, 168;
    --bs-info-bg-subtle: #d7f0f4;
    --bs-info-border-subtle: #a6dde6;

    --afd-sidebar-width: 250px;
    --afd-sidebar-bg-top: #171b30;
    --afd-sidebar-bg-bottom: #232a52;
}

body {
    background-color: #f3f4f9;
}

/* ---------------------------------------------------------------------
   Sidebar — subtle gradient instead of a flat rectangle, refined active
   state with a left accent bar rather than just a solid fill.
   --------------------------------------------------------------------- */
.portal-sidebar {
    width: var(--afd-sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--afd-sidebar-bg-top) 0%, var(--afd-sidebar-bg-bottom) 100%);
}

.portal-sidebar .nav-link {
    border-radius: 8px;
    opacity: 0.78;
    transition: background-color 0.15s ease, opacity 0.15s ease;
    border-left: 3px solid transparent;
}

.portal-sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    opacity: 1;
}

.portal-sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.12);
    border-left-color: #7c8bf0;
    opacity: 1;
    font-weight: 600;
}

.portal-main {
    min-height: 100vh;
}

/* ---------------------------------------------------------------------
   Cards — a touch more depth than Bootstrap's flat default, consistent
   across every page since most content sits in a .card.
   --------------------------------------------------------------------- */
.card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
}

/* ---------------------------------------------------------------------
   Stat cards — icon-badge treatment (colored circle + icon) rather than
   just colored numbers, so the dashboard/reports actually pop instead
   of reading as plain black-and-white text on a white card.
   --------------------------------------------------------------------- */
.stat-card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.10);
    transform: translateY(-1px);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon-badge.bg-primary-subtle { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.stat-icon-badge.bg-success-subtle-custom { background: var(--bs-success-bg-subtle); color: var(--bs-success); }
.stat-icon-badge.bg-info-subtle-custom { background: var(--bs-info-bg-subtle); color: var(--bs-info); }
.stat-icon-badge.bg-danger-subtle-custom { background: var(--bs-danger-bg-subtle); color: var(--bs-danger); }
.stat-icon-badge.bg-warning-subtle-custom { background: var(--bs-warning-bg-subtle); color: var(--bs-warning); }

/* ---------------------------------------------------------------------
   Tables — slightly more refined header + hover than Bootstrap default.
   --------------------------------------------------------------------- */
.table thead.table-light th {
    background-color: #f8f9fc;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #667085;
    font-weight: 600;
    border-bottom-width: 1px;
}

.table-hover > tbody > tr:hover > * {
    background-color: #f7f8ff;
}

.kb-row:hover {
    background-color: #f7f8ff;
}

.table-clickable-row {
    cursor: pointer;
}

/* ---------------------------------------------------------------------
   Sortable table headers
   --------------------------------------------------------------------- */
.afd-sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.afd-sortable-th:hover {
    background-color: rgba(74, 95, 232, 0.08) !important;
}

.afd-sort-arrow {
    display: inline-block;
    width: 0.9em;
    color: var(--bs-primary);
    font-size: 0.75em;
}

/* ---------------------------------------------------------------------
   Buttons — slightly softer corners than Bootstrap default, matching
   the rest of the refined shape language (cards, badges).
   --------------------------------------------------------------------- */
.btn {
    border-radius: 8px;
}

.btn-sm {
    border-radius: 6px;
}

/* ---------------------------------------------------------------------
   Badges — a touch more padding/weight than Bootstrap's stock badge so
   status labels (call status, appointment status, etc.) read clearly
   at a glance across every list page.
   --------------------------------------------------------------------- */
.badge {
    font-weight: 600;
    padding: 0.4em 0.65em;
    border-radius: 6px;
}

/* ---------------------------------------------------------------------
   FullCalendar (Appointments page) — themed to match the portal's own
   palette instead of FullCalendar's stock blue/gray defaults. FullCal
   exposes its own CSS custom properties, same pattern as Bootstrap's,
   so this re-skins the whole calendar without fighting its internals.
   --------------------------------------------------------------------- */
#appt-calendar {
    --fc-border-color: #e5e7f0;
    --fc-page-bg-color: #ffffff;
    --fc-neutral-bg-color: #f8f9fc;
    --fc-list-event-hover-bg-color: #f7f8ff;
    --fc-highlight-color: rgba(74, 95, 232, 0.12);
    --fc-today-bg-color: rgba(74, 95, 232, 0.06);
    --fc-button-bg-color: #4a5fe8;
    --fc-button-border-color: #4a5fe8;
    --fc-button-hover-bg-color: #3444b0;
    --fc-button-hover-border-color: #3444b0;
    --fc-button-active-bg-color: #3444b0;
    --fc-button-active-border-color: #3444b0;
    font-size: 0.92rem;
}

#appt-calendar .fc-toolbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1f3a;
}

#appt-calendar .fc-col-header-cell {
    background-color: #f8f9fc;
    padding: 8px 0;
}

#appt-calendar .fc-col-header-cell-cushion {
    color: #667085;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    text-decoration: none;
}

#appt-calendar .fc-daygrid-day-number,
#appt-calendar .fc-timegrid-slot-label-cushion {
    color: #475467;
    font-size: 0.82rem;
    text-decoration: none;
}

#appt-calendar .fc-day-today .fc-daygrid-day-number {
    color: #4a5fe8;
    font-weight: 700;
}

#appt-calendar .fc-event {
    border-radius: 6px;
    border-width: 0;
    padding: 2px 4px;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}

#appt-calendar .fc-event:hover {
    filter: brightness(0.92);
    cursor: pointer;
}

#appt-calendar .fc-button {
    text-transform: capitalize;
    font-weight: 500;
    box-shadow: none !important;
}

#appt-calendar .fc-daygrid-day.fc-day-today,
#appt-calendar .fc-timegrid-col.fc-day-today {
    background-color: var(--fc-today-bg-color);
}

/* ---------------------------------------------------------------------
   Data-entry dialogs — every Add/Edit modal in the app (appointments,
   contacts, leads, knowledge base, users, phone numbers, business
   rules) shares this same markup shape (.modal-title, .form-label,
   .form-control/.form-select), so coloring it once here colors all of
   them consistently instead of a plain black-on-white Bootstrap form.
   --------------------------------------------------------------------- */
.modal-title {
    color: var(--bs-primary-text-emphasis);
    font-weight: 700;
}

.modal-body .form-label {
    color: var(--bs-primary-text-emphasis);
    font-weight: 600;
    font-size: 0.85rem;
}

.modal-body .form-control,
.modal-body .form-select {
    border-color: var(--bs-primary-border-subtle);
    background-color: #fbfbff;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: var(--bs-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(74, 95, 232, 0.15);
}
