/* ============================================================
   Pharmacy Branches - Stylesheet
   ============================================================ */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Helvetica, Arial, sans-serif;
    background: #f5f7fa;
    color: #1f2937;
    line-height: 1.45;
}

header {
    background: #0b5394;
    color: #fff;
    padding: 18px 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

main {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 16px;
}

/* ------------- Search bar ------------- */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.search-bar input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
    background: #fff;
}
.search-bar input[type="text"]:focus {
    outline: none;
    border-color: #0b5394;
    box-shadow: 0 0 0 3px rgba(11,83,148,0.18);
}

/* ------------- Buttons ------------- */
button, .btn {
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #0b5394;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color .15s;
}
button:hover, .btn:hover     { background: #0a4279; }
button.secondary             { background: #e2e8f0; color: #1f2937; }
button.secondary:hover       { background: #cbd5e1; }
button.danger                { background: #b91c1c; }
button.danger:hover          { background: #991b1b; }
button.small                 { padding: 4px 10px; font-size: 0.85rem; }
button:disabled               { background: #cbd5e1; color: #64748b; cursor: default; }
button:disabled:hover         { background: #cbd5e1; }

/* Branch-form save status text */
.saved-ok    { color: #166534; font-size: 0.85rem; font-weight: 600; }
.saved-dirty { color: #b45309; font-size: 0.85rem; font-weight: 600; }
.saved-error { color: #991b1b; font-size: 0.85rem; font-weight: 600; }

/* ------------- Results table ------------- */
.results {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: top;
}
th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}
tr:hover td { background: #f8fafc; }

/* Sortable column headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th.sortable:hover { background: #eef2f7; }
th.sortable .sort-arrow {
    display: inline-block;
    width: 12px;
    margin-left: 6px;
    color: #94a3b8;
    font-size: 0.85em;
}
th.sortable.sort-asc  .sort-arrow::after { content: "\25B2"; color: #0b5394; } /* ▲ */
th.sortable.sort-desc .sort-arrow::after { content: "\25BC"; color: #0b5394; } /* ▼ */
.empty-state {
    padding: 24px;
    text-align: center;
    color: #6b7280;
}

/* ------------- Pagination ------------- */
.pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    padding: 4px 2px;
    font-size: 0.9rem;
    color: #475569;
}
.per-page-label { display: flex; align-items: center; gap: 6px; }
.per-page-label select {
    padding: 5px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
}
.page-info { color: #6b7280; }
.page-buttons {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-wrap: wrap;
}
.page-buttons button {
    min-width: 34px;
    padding: 5px 8px;
    background: #fff;
    color: #0b5394;
    border: 1px solid #cbd5e1;
    font-size: 0.88rem;
}
.page-buttons button:hover:not(:disabled) { background: #eef2f7; }
.page-buttons button.current {
    background: #0b5394;
    color: #fff;
    border-color: #0b5394;
    cursor: default;
}
.page-buttons button:disabled {
    color: #cbd5e1;
    cursor: default;
}
.page-buttons .page-gap {
    min-width: 20px;
    text-align: center;
    color: #94a3b8;
    align-self: center;
}

/* ------------- Modal ------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 50;
    padding: 30px 16px;
    overflow-y: auto;
}
.modal-backdrop.open { display: flex; }

.modal {
    background: #fff;
    width: 100%;
    max-width: 880px;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    overflow: hidden;
    margin-bottom: 30px;
}
.modal header {
    background: #0b5394;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}
.modal header .close-btn {
    background: transparent;
    color: #fff;
    border: none;
    font-size: 1.4rem;
    padding: 0 4px;
    cursor: pointer;
}

/* Tabs inside modal */
.tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.tab {
    padding: 10px 16px;
    cursor: pointer;
    color: #475569;
    border-bottom: 2px solid transparent;
    font-size: 0.95rem;
}
.tab.active {
    color: #0b5394;
    border-bottom-color: #0b5394;
    background: #fff;
}
.tab-pane          { display: none; padding: 18px; }
.tab-pane.active   { display: block; }

/* Form grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}
.form-grid label { display: flex; flex-direction: column; font-size: 0.85rem; color: #475569; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input,
.form-grid textarea,
.form-grid select {
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
}
.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus {
    outline: none;
    border-color: #0b5394;
    box-shadow: 0 0 0 3px rgba(11,83,148,0.15);
}

/* Hours table inside modal */
.hours-table, .exc-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}
.hours-table th, .hours-table td,
.exc-table th,   .exc-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #eef2f7;
}
.hours-table input, .exc-table input,
.hours-table select, .exc-table select {
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 100%;
}
.hours-table input[type="time"],
.exc-table input[type="time"] { width: 110px; }
.exc-table input[type="date"]  { width: 150px; }

/* Day grouping in the standard-hours editor: a stronger divider above
   each new day, and a faint shade on alternate days, so the two shifts
   of a split day clearly read as one block. */
.hours-table tr.day-first td             { border-top: 2px solid #cbd5e1; }
.hours-table tr.day-first:first-child td { border-top: none; }
.hours-table tr.day-alt td               { background: #f1f5f9; }
.hours-table tr:hover td                 { background: #e8eef6; }

.row-actions          { white-space: nowrap; }
.row-actions button + button { margin-left: 4px; }
.add-row-btn          { margin-top: 8px; }

.footer-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}
.footer-actions .right { display: flex; gap: 8px; }

/* Misc */
.muted        { color: #6b7280; font-size: 0.85rem; }
.status-msg   { padding: 10px 14px; font-size: 0.9rem; border-radius: 6px; }
.status-msg.error   { background: #fee2e2; color: #991b1b; }
.status-msg.success { background: #dcfce7; color: #166534; }
.status-msg.sticky  { position: relative; line-height: 1.55; border: 1px solid currentColor; padding-right: 36px; user-select: text; }
.status-close {
    position: absolute;
    top: 4px;
    right: 6px;
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.status-close:hover { background: rgba(0,0,0,0.06); }

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    th.optional, td.optional { display: none; }
}

/* ------------- Unsaved-changes confirm dialog ------------- */
/* Sits ABOVE the branch modal (.modal-backdrop is z-index 50). */
.confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    padding: 20px;
}
.confirm-box {
    background: #fff;
    width: 100%;
    max-width: 430px;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    padding: 22px 24px;
}
.confirm-box h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}
.confirm-box p {
    margin: 0 0 18px;
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.5;
}
.confirm-actions { display: flex; gap: 8px; }
/* Push the destructive button well clear of the default Save button. */
.confirm-actions .confirm-discard { margin-right: auto; }
.confirm-actions button:focus-visible {
    outline: 2px solid #0b5394;
    outline-offset: 2px;
}

/* ============================================================
   Public directory (directory.php) — read-only
   ============================================================ */

/* Whole result rows are clickable links to the info panel. */
tr.result-row { cursor: pointer; }
tr.result-row:hover td { background: #eef4fb; }
tr.result-row:focus-visible {
    outline: 2px solid #0b5394;
    outline-offset: -2px;
}

/* ------------- Read-only info panel ------------- */
.info-modal { max-width: 560px; }
.info-body  { padding: 18px 20px 22px; }

/* Open-now / closed badge */
.info-badge {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
}
.info-badge strong { font-size: 1.05rem; }
.info-badge span   { font-size: 0.9rem; }
.info-badge.open   { background: #dcfce7; color: #166534; }
.info-badge.closed { background: #fee2e2; color: #991b1b; }

.info-section { margin-top: 20px; }
.info-section h3 {
    margin: 0 0 8px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
}
.info-address { margin: 0 0 8px; line-height: 1.5; }

.info-map {
    display: inline-block;
    color: #0b5394;
    font-weight: 600;
    text-decoration: none;
}
.info-map:hover { text-decoration: underline; }

/* Contact lines: label left, value right */
.info-line {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}
.info-line:last-child { border-bottom: none; }
.info-line > span { color: #6b7280; }
.info-line a { color: #0b5394; text-decoration: none; word-break: break-all; }
.info-line a:hover { text-decoration: underline; }
.info-line code {
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Weekly opening-hours table */
.info-hours { width: 100%; border-collapse: collapse; }
.info-hours th,
.info-hours td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}
.info-hours th { font-weight: 500; width: 45%; }
.info-hours tr:last-child th,
.info-hours tr:last-child td { border-bottom: none; }
.info-hours tr.info-today th,
.info-hours tr.info-today td { background: #eff6ff; font-weight: 600; }
.info-today-tag {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0b5394;
    background: #dbeafe;
    padding: 1px 6px;
    border-radius: 999px;
    margin-left: 6px;
}
.info-closed { color: #b91c1c; }

/* Upcoming exceptions list */
.info-exc { list-style: none; margin: 0; padding: 0; }
.info-exc li {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 7px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}
.info-exc li:last-child { border-bottom: none; }
.info-exc-date   { font-weight: 600; min-width: 130px; }
.info-exc-reason { color: #6b7280; width: 100%; font-size: 0.88rem; }

.info-error { color: #991b1b; }

/* ============================================================
   Admin / User management page  (users.php)
   ============================================================ */

/* Tab strip — matches the modal .tabs style but sits on the page */
.admin-tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    gap: 0;
    margin-bottom: 20px;
}
.admin-tab {
    padding: 10px 22px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0;
    transition: color .15s;
}
.admin-tab:hover         { background: #f8fafc; color: #1f2937; }
.admin-tab.active        { color: #0b5394; border-bottom-color: #0b5394; background: transparent; }

/* Panel cards */
.admin-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    padding: 20px 24px;
    margin-bottom: 24px;
}
.admin-panel > p { margin-top: 0; }

/* Tables inside admin panels get the same card look as .results */
.admin-panel table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    margin: 0 -24px;          /* bleed to panel edges */
    width: calc(100% + 48px);
}
.admin-panel th,
.admin-panel td {
    padding: 10px 24px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
}
.admin-panel th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    text-align: left;
}
.admin-panel tr:last-child td { border-bottom: none; }
.admin-panel tr:hover td      { background: #f8fafc; }

/* Role badges */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.role-admin           { background: #dbeafe; color: #1e40af; }
.role-company_manager { background: #fef9c3; color: #854d0e; }
.role-branch_manager  { background: #f1f5f9; color: #475569; }

/* ---------------------------------------------------------------
   Branch access section in the user edit modal
   --------------------------------------------------------------- */

/* Section headings */
.branch-section-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 12px;
}
.branch-section-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1f2937;
}
.branch-search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.branch-search-box input { flex: 1; }

.branch-results-label {
    margin: 0 0 8px;
    font-size: 0.85rem;
    color: #475569;
}
.branch-assigned-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 16px 0 6px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e2e8f0;
}

/* Each branch row (both search result and assigned) */
.branch-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid #e2e8f0;
    background: #fff;
}
.branch-row--result  { background: #f8fafc; }
.branch-row--added   { background: #f0fdf4; border-color: #bbf7d0; opacity: 0.75; }
.branch-row--assigned { background: #eff6ff; border-color: #bfdbfe; }

.branch-row-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.branch-row-info strong { font-size: 0.95rem; color: #1f2937; }
.branch-row-info .muted { font-size: 0.82rem; }

/* Add button — prominent green */
.branch-btn-add {
    padding: 8px 16px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.branch-btn-add:hover:not(:disabled) { background: #15803d; }
.branch-btn-add:disabled {
    background: #d1fae5;
    color: #166534;
    cursor: default;
}

/* Remove button — clear red */
.branch-btn-remove {
    padding: 8px 16px;
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.branch-btn-remove:hover { background: #fecaca; border-color: #f87171; }

/* Empty state */
.branch-empty-state {
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: #6b7280;
    font-size: 0.9rem;
    text-align: center;
}

/* Search results container */
#uBranchResults {
    margin-bottom: 4px;
    max-height: 280px;
    overflow-y: auto;
}

/* ---------------------------------------------------------------
   Standalone text inputs in admin panels and modals
   (add-company row, add-service-type row, branch search)
   Not inside .form-grid so they need their own rule.
   --------------------------------------------------------------- */
.admin-panel input[type="text"],
.admin-panel input[type="email"],
.modal input[type="text"],
.modal input[type="email"] {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: #1f2937;
}
.admin-panel input[type="text"]:focus,
.admin-panel input[type="email"]:focus,
.modal input[type="text"]:focus,
.modal input[type="email"]:focus {
    outline: none;
    border-color: #0b5394;
    box-shadow: 0 0 0 3px rgba(11,83,148,0.15);
}

/* The add-row div sits below the table; give it a top border to
   separate it cleanly from the last table row. */
.admin-panel > div:last-child {
    border-top: 1px solid #eef2f7;
    margin: 0 -24px -20px;
    padding: 14px 24px;
    background: #f8fafc;
    border-radius: 0 0 8px 8px;
}

/* ============================================================
   Profile page
   ============================================================ */

/* Wider layout than the narrow auth forms, but still centred */
.ps-main-profile {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 16px 48px;
}

/* Two-column grid on wide screens, single column on mobile */
.profile-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
    margin-top: 24px;
}
@media (max-width: 720px) {
    .profile-layout { grid-template-columns: 1fr; }
}

.profile-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Individual cards */
.profile-card {
    background: #fff;
    border: 1px solid #d1dce8;
    border-radius: 10px;
    padding: 22px 24px 18px;
    box-shadow: 0 1px 3px rgba(11,83,148,0.06);
}

.profile-section-title {
    margin: 0 0 16px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1f2937;
    border-bottom: 1px solid #eef2f7;
    padding-bottom: 10px;
}

/* Read-only fields look distinct */
.readonly-field {
    background: #f1f5f9 !important;
    color: #64748b !important;
    cursor: default !important;
    border-color: #dde3eb !important;
}
.readonly-field:focus {
    box-shadow: none !important;
    border-color: #dde3eb !important;
}
.profile-readonly-note {
    font-size: 0.83em;
    color: #94a3b8;
    margin: 6px 0 0;
}

/* Inline hint text under a field label, before the input */
.ps-field-hint-inline {
    display: block;
    font-size: 0.8em;
    font-weight: 400;
    color: #94a3b8;
    margin-bottom: 3px;
}

/* Save button row inside each card — reuses .footer-actions from style.css,
   but needs negative margins so it bleeds to the card edges */
.profile-footer {
    margin: 16px -24px -18px;
    border-radius: 0 0 9px 9px;
}

/* (profile-status rules removed — now uses .saved-ok / .saved-dirty / .saved-error) */

/* ============================================================
   GDPR consent card
   ============================================================ */

.profile-card--gdpr {
    border-color: #c7d9ef;
    background: #f8fbff;
}

.gdpr-consented-banner {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.95em;
    font-weight: 500;
}

/* GDPR checkbox — used on both register.php and profile.php */
.gdpr-checkbox-label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.9em;
    color: #374151;
    cursor: pointer;
    line-height: 1.45;
}
.gdpr-checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: #0b5394;
    cursor: pointer;
}
/* Extra top margin when used in the register form */
.gdpr-signup {
    margin: 16px 0 4px;
}

/* "Hi, Chris ⚙" nav link */
.ps-nav-user-link {
    text-decoration: none;
    color: inherit;
    font-size: 0.92em;
    opacity: 0.85;
    transition: opacity 0.15s;
}
.ps-nav-user-link:hover,
.ps-nav-user-link.is-active {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============================================================
   Avatar — shared across nav bar and profile page
   ============================================================ */

/* Base circle — kept in sync with site.css (which loads on every page) */
.ps-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;          /* clips <img> into the circle */
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

/* Nav size — 32 px */
.ps-avatar--nav {
    width: 32px;
    height: 32px;
    font-size: 0.72rem;
}

/* Profile page size — 80 px */
.ps-avatar--lg {
    width: 80px;
    height: 80px;
    font-size: 1.6rem;
}

/* Photo variant — object-fit clips the image; size comes from --nav / --lg */
.ps-avatar--photo {
    object-fit: cover;
}

/* ============================================================
   Nav avatar link  (replaces old ps-nav-user-link)
   ============================================================ */

.ps-nav-avatar-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    border-radius: 20px;
    padding: 2px 8px 2px 2px;
    transition: background 0.15s;
}
.ps-nav-avatar-link:hover,
.ps-nav-avatar-link.is-active {
    background: rgba(255,255,255,0.15);
}
.ps-nav-greeting {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ============================================================
   Profile page — avatar banner
   ============================================================ */

.profile-avatar-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    border: 1px solid #d1dce8;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 4px;
    box-shadow: 0 1px 3px rgba(11,83,148,0.06);
}

/* The clickable avatar circle wrapper */
.profile-avatar-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 50%;
    outline-offset: 3px;
}
.profile-avatar-wrap:focus-visible {
    outline: 2px solid #0b5394;
}

/* Camera overlay shown on hover */
.profile-avatar-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0,0,0,0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.18s;
    pointer-events: none;
}
.profile-avatar-wrap:hover .profile-avatar-overlay {
    opacity: 1;
}

/* Spinner pulse during upload */
.avatar-uploading .ps-avatar {
    opacity: 0.5;
    animation: avatar-pulse 0.8s ease-in-out infinite alternate;
}
@keyframes avatar-pulse {
    from { opacity: 0.5; }
    to   { opacity: 0.9; }
}

.profile-avatar-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.profile-avatar-name {
    font-size: 1.15rem;
}
.profile-avatar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}
/* The "Upload photo" label styled as a button */
.avatar-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.92rem;
    padding: 7px 14px;
}
.avatar-upload-btn:hover { background: #0a4279; }
/* Status line below the buttons */
.avatar-status-msg {
    display: block;
    font-size: 0.88em;
    min-height: 1.2em;
}
/* Small hint about file formats */
.profile-avatar-hint {
    font-size: 0.8em;
    color: #94a3b8;
    margin: 0;
}

/* Remove the old ps-nav-user style now replaced by ps-nav-avatar-link */
.ps-nav-user { display: none; }

/* ============================================================
   Service-type filter bar
   ============================================================ */
.sf-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 4px;
}
.sf-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    margin-right: 2px;
}
.sf-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
}
.sf-pill:hover {
    border-color: #0b5394;
    color: #0b5394;
}
.sf-pill.is-active {
    background: #0b5394;
    border-color: #0b5394;
    color: #fff;
}
.sf-pill.is-active:hover {
    background: #0a4279;
    border-color: #0a4279;
}
/* Checkmark icon inside active pill */
.sf-pill-check {
    font-size: 0.75rem;
    line-height: 1;
}

/* ============================================================
   Admin tools page
   ============================================================ */
.admin-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}
.admin-section h2 {
    margin: 0 0 6px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2937;
}
.admin-section > .muted {
    margin: 0 0 18px;
    font-size: 0.9rem;
}
.admin-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.tool-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tool-card--wide {
    grid-column: 1 / -1;
}
.tool-card h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
}
.tool-card .muted {
    margin: 0;
    font-size: 0.9rem;
    color: #475569;
    flex: 1;
}
.companies-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
    margin-top: 16px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th,
.admin-table td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.93rem;
}
.admin-table th {
    font-weight: 600;
    color: #475569;
    background: #f8fafc;
}
.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1;
    transition: background 0.12s;
}
.icon-btn:hover        { background: #f1f5f9; }
.icon-btn.danger:hover { background: #fee2e2; }
.field-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
}
.field-label input {
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #1f2937;
}
.field-label input:focus {
    outline: none;
    border-color: #0b5394;
    box-shadow: 0 0 0 3px rgba(11,83,148,0.15);
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

@media (max-width: 720px) {
    .companies-layout { grid-template-columns: 1fr; }
    .admin-tools-grid { grid-template-columns: 1fr; }
    .tool-card--wide  { grid-column: auto; }
}
