/* ============================================================
   Libris - components.css
   Additional component styles
   ============================================================ */

/* This file is kept for backwards compatibility.
   Core component styles are now in main.css.
   Only extension styles live here. */

/* ================================================================
   DASHBOARD PANELS - 4-panel grid layout
   ================================================================ */

/* 2x2 panel grid */
.db-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-5);
    margin-top: var(--sp-5);
}

/* Red left border on panel titles */
.db-panel__accent-bar {
    border-left: 3px solid var(--color-accent);
    padding-left: var(--sp-3);
}

/* Item list */
.db-item-list { list-style: none; margin: 0; padding: 0; }

.db-item-list__empty {
    padding: var(--sp-6) var(--sp-5);
    font-size: 0.82rem;
    color: var(--color-muted);
    text-align: center;
}

.db-item { border-bottom: 1px solid var(--color-border-subtle); }
.db-item:last-child { border-bottom: none; }

.db-item__link {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    text-decoration: none;
    transition: background var(--ease);
}
.db-item__link:hover { background: #fafafa; text-decoration: none; }

/* Book cover thumbnail */
.db-item__cover {
    width: 52px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-subtle);
    flex-shrink: 0;
}
.db-item__cover--placeholder {
    width: 52px;
    height: 72px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.db-item__cover--overdue {
    border-color: rgba(220,38,38,0.25);
    background: var(--color-red-soft);
}

/* Member avatar circle */
.db-item__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-accent-soft);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Text block */
.db-item__info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.db-item__title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.db-item__sub   { font-size: 0.78rem; color: var(--color-muted); }
.db-item__due   { font-size: 0.75rem; color: var(--color-muted); }
.db-item__due--overdue { color: var(--color-red); font-weight: 500; }

/* Quick-action Modals */
.db-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
}
.db-modal-backdrop[hidden] { display: none; }

.db-modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

.db-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-6) var(--sp-6) var(--sp-5);
    border-bottom: 1px solid var(--color-border-subtle);
}
.db-modal__title {
    font-family: var(--font-body);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.01em;
}
.db-modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0 var(--sp-1);
    transition: color var(--ease);
}
.db-modal__close:hover { color: var(--color-text); }

.db-modal__body { padding: var(--sp-6); overflow-y: auto; flex: 1; }

.db-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--color-border-subtle);
}

/* Autocomplete dropdown */
.db-ac-wrap { position: relative; }

.db-ac-list {
    position: absolute;
    top: calc(100% - 0.25rem);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 200;
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}
.db-ac-list[hidden] { display: none; }

.db-ac-item {
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    font-size: 0.855rem;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border-subtle);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    transition: background var(--ease);
}
.db-ac-item:last-child { border-bottom: none; }
.db-ac-item:hover,
.db-ac-item.is-focused { background: var(--color-accent-soft); }
.db-ac-item__sub      { font-size: 0.72rem; color: var(--color-muted); }
.db-ac-item__inactive { font-size: 0.72rem; color: var(--color-red); }

/* Selected pill shown after picking */
.db-selected-pill {
    margin-top: var(--sp-2);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    background: var(--color-accent-soft);
    color: var(--color-accent);
    border: 1px solid rgba(255,107,53,0.2);
    border-radius: var(--radius-full);
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
}
.db-selected-pill[hidden] { display: none; }

.db-pill-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-accent);
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.1rem;
}
.db-pill-clear:hover { color: var(--color-accent-hover); }

/* Responsive */
@media (max-width: 700px) {
    .db-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   LANGUAGE SWITCHER
   Shared by every layout (OPAC, member portal, staff, kiosk,
   sign-in). A compact EL / EN segmented control; the active
   locale is a plain <span>, the other a link carrying ?lang=.
   ================================================================ */
.lang-switch {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    padding: 2px;
    line-height: 1;
}

.lang-switch__option {
    display: inline-block;
    padding: 0.28rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none;
    color: var(--color-muted);
    transition: background var(--ease), color var(--ease);
}

.lang-switch__option:hover {
    color: var(--color-text);
    background: var(--color-border-subtle);
}

.lang-switch__option--active {
    background: var(--color-navy);
    color: #fff;
    cursor: default;
}

.lang-switch__option--active:hover {
    background: var(--color-navy);
    color: #fff;
}

/* On dark surfaces (kiosk, footers) the default light chrome
   disappears — invert the frame and idle text. */
.lang-switch--on-dark {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.22);
}

.lang-switch--on-dark .lang-switch__option { color: rgba(255,255,255,0.72); }

.lang-switch--on-dark .lang-switch__option:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

.lang-switch--on-dark .lang-switch__option--active,
.lang-switch--on-dark .lang-switch__option--active:hover {
    background: #fff;
    color: var(--color-ink);
}

/* Kiosk is touch-operated at arm's length — bigger tap targets. */
.lang-switch--kiosk .lang-switch__option {
    padding: 0.55rem 1.1rem;
    font-size: 1rem;
}

/* Placement of the switcher inside each shell */
.sidebar__lang {
    padding: 0 var(--sp-4) var(--sp-3);
    display: flex;
    justify-content: flex-start;
}

.mobile-topbar .lang-switch { margin-left: auto; }

.auth-lang {
    display: flex;
    justify-content: center;
    margin-bottom: var(--sp-4);
}

/* The OPAC header is a flex row: brand · nav · switcher · actions.
   Keep the switcher from being squeezed out at narrow widths. */
.opac-body .opac-header__inner > .lang-switch { margin-left: auto; }

/* Below the nav's breakpoint the switcher is the phone header's
   right-hand control (it replaced the search circle) — opac.css keeps
   it pinned there, and the sign-in / account buttons sit beside it
   rather than being pushed to a second auto margin of their own. */
@media (max-width: 700px) {
    .opac-body .opac-header__inner > .lang-switch ~ .opac-header__actions,
    .opac-body .opac-header__inner > .lang-switch ~ .member-bell {
        margin-inline-start: 0;
    }
}

/* ================================================================
   PASSWORD REQUIREMENTS CHECKLIST
   A live-updating rule list under a "choose a password" field —
   see public/js/password-strength.js.
   ================================================================ */
.pw-requirements {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem var(--sp-4);
    margin: var(--sp-2) 0 0;
    padding: 0;
    font-size: 0.78rem;
}

.pw-requirements__item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--color-muted-light);
    transition: color 0.15s ease;
}

.pw-requirements__item::before {
    content: '';
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--color-muted-light);
    transition: background 0.15s ease;
}

.pw-requirements__item--met {
    color: var(--color-text);
    font-weight: 600;
}

.pw-requirements__item--met::before { background: var(--color-accent); }
