/* SOUBOR: css/ui-elements.css (v2.4 – 2026-02-18) */
/* POPIS: UI elementy, formulářové prvky a komponenty pro řádkový výpis směn. */

/* --- 1. LOADER & SPINNER --- */
#loader {
    position: fixed;
    inset: 0;
    background: var(--c-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--c-border);
    border-top-color: var(--c-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    font-weight: 800;
    color: var(--c-text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.spinner-small-center {
    width: 24px;
    height: 24px;
    border: 3px solid var(--c-border);
    border-top-color: var(--c-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
    display: block;
}

/* ✅ PROGRESS LOADER (0-100%) */
#progress-loader {
    position: fixed;
    inset: 0;
    background: var(--c-bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 70%;
    max-width: 280px;
}

.progress-percentage {
    font-weight: 800;
    color: #000000;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    order: 1;
}

.progress-bar-wrapper {
    width: 100%;
    height: 12px;
    background: var(--c-border);
    border-radius: 100px;
    overflow: hidden;
    order: 2;
}

.progress-bar-fill {
    height: 100%;
    background: var(--c-green);
    border-radius: 100px;
    width: 0%;
    transition: width 0.1s linear;
}

.progress-text {
    font-weight: 600;
    color: var(--c-text-muted);
    font-size: 0.9rem;
    letter-spacing: -0.01em;
    order: 3;
}

/* --- 2. TOAST NOTIFICATIONS --- */
#toast {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    transform: translateY(-20px);
    opacity: 0;
    background: var(--c-card);
    color: var(--c-text-main);
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-float);
    font-weight: 600;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    width: fit-content;
    max-width: 90%;
}

#toast.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

#toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#toast-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.5px;
}

/* --- 3. ICONS & BADGES --- */
.role-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: transparent;
    padding: 0;
}

.icon-badge-round {
    background-color: var(--c-card);
    border: 1px solid var(--c-border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-accent);
    flex-shrink: 0;
}

.icon-badge-round svg {
    width: 18px;
    height: 18px;
}

.kpi-icon-badge {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-accent);
}

.kpi-icon-badge svg {
    width: 18px;
    height: 18px;
}

.status-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin: 0 auto 24px auto;
    padding: 6px 16px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

.status-pill.gray { background: var(--c-input-bg); color: var(--c-text-main); }
.status-pill.yellow { background: rgba(255, 204, 0, 0.15); color: #000000; }
.status-pill.green { background: rgba(52, 199, 89, 0.15); color: #000000; }
.status-pill.purple { background: var(--c-purple-bg); color: #000000; }

.name-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 16px;
    font-size: 0.85rem;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 1px solid transparent;
}

.name-pill:active { transform: scale(0.96); }
.name-pill.gray { background-color: var(--c-input-bg); color: var(--c-text-muted); }
.name-pill.green { background-color: rgba(52, 199, 89, 0.15); border-color: rgba(52, 199, 89, 0.4); color: #000000; }

.status-dots-group {
    display: flex;
    justify-content: center;
    gap: 3px;
}

/* ✅ GRID PRO ZÁJEMCE (2 sloupce + scroll) */
.interest-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 16px;
    margin-bottom: 24px;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden; /* ✅ Skrýt horizontální scroll (shadow efekt) */
    padding: 8px 4px 0 4px; /* ✅ Přidat padding nahoře pro křížky */
}

/* Scrollbar styling */
.interest-grid::-webkit-scrollbar {
    width: 6px;
}

.interest-grid::-webkit-scrollbar-track {
    background: var(--c-input-bg);
    border-radius: 10px;
}

.interest-grid::-webkit-scrollbar-thumb {
    background: var(--c-border);
    border-radius: 10px;
}

.interest-grid::-webkit-scrollbar-thumb:hover {
    background: var(--c-text-muted);
}

/* ✅ ŽLUTÝ BADGE ZÁJEMCE */
.interest-badge {
    position: relative;
    background: rgba(255, 204, 0, 0.15);
    border: 1px solid rgba(255, 204, 0, 0.3);
    border-radius: 12px;
    padding: 10px 8px;
    cursor: pointer;
    transition: var(--trans-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 52px;
    overflow: visible; /* ✅ Aby křížek nebyl ořezán */
}

.interest-badge:active {
    transform: scale(0.97);
    background: rgba(255, 204, 0, 0.25);
}

.interest-badge-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #000000;
    white-space: nowrap;
    text-align: center;
}

.interest-badge-time {
    font-size: 0.7rem;
    color: #000000;
    font-weight: 400;
    white-space: nowrap;
    text-align: center;
}

/* ✅ ČERVENÝ KŘÍŽEK PRO SMAZÁNÍ ZÁJEMCE */
.interest-cross-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--c-red);
    color: white;
    border: 2px solid var(--c-card);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--trans-fast);
    z-index: 10;
}

.interest-cross-btn:active {
    transform: scale(0.9);
}

/* ✅ SHAKE ANIMACE (při aktivním editačním módu) */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.interest-badge.shake {
    animation: shake 0.5s ease-in-out;
}

/* --- 5. SHIFT ROWS (Řádkový systém v modálu) --- */
.shift-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 12px;
    transition: var(--trans-fast);
}

.shift-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.row-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--c-text-main);
}

.row-time {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    font-weight: 500;
}

/* UPDATE: Cena je černá, zarovnaná doprava a odsazená od ikon */
.shift-row-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--c-text-main); /* Černá */
    margin-left: auto;         /* Tlačí cenu co nejvíce doprava */
    margin-right: 24px;        /* Mezera mezi cenou a tlačítky */
    min-width: 70px;           /* Fixní minimální šířka pro zarovnání pod sebe */
    text-align: right;
}

.shift-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--trans-fast);
}

.action-btn.edit { background: rgba(230, 74, 25, 0.1); color: var(--c-accent); }
.action-btn.delete { background: rgba(255, 59, 48, 0.1); color: var(--c-red); }

.action-btn svg { width: 18px; height: 18px; stroke-width: 2px; }
.action-btn:active { transform: scale(0.9); }

/* --- 6. INPUTS & TEXT UTILITIES --- */
.text-label-gray, .text-label-bold { font-weight: 800; color: var(--c-text-muted); letter-spacing: 0.5px; }
/* .text-green definováno v base.css – duplikát odstraněn */
.text-red { color: var(--c-red); }
.input-group { margin-bottom: 16px; position: relative; }

.styled-input,
input[type="password"].styled-input,
input[type="text"].styled-input,
input[type="number"].styled-input {
    width: 100%;
    padding: 16px;
    background-color: var(--c-input-bg) !important;
    border: 1px solid transparent;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #000000;
    outline: none;
    transition: var(--trans-fast);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--c-input-bg) inset !important;
    -webkit-text-fill-color: #000 !important;
    transition: background-color 5000s ease-in-out 0s;
}

.styled-input:focus {
    border-color: var(--c-green);
    background-color: var(--c-card) !important;
    box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.1);
}

.styled-input::placeholder { color: var(--c-text-muted); opacity: 0.7; font-weight: 500; }
input[type="time"].styled-input { text-align: center; display: block; }

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

#payInputHours::-webkit-inner-spin-button,
#payInputHours::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#payInputHours { -moz-appearance: textfield; }

select.styled-input {
    cursor: pointer;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
}

/* --- 7. BUTTONS --- */
.btn {
    border: none;
    padding: 0 24px;
    height: 52px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.12s ease, filter 0.12s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    will-change: transform;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
}

.btn-fit {
    width: auto;
    min-width: 140px;
    padding: 0 32px;
}

.btn:active { transform: scale(0.96); filter: brightness(0.93); }
.btn-table { height: 32px; padding: 0 16px; font-size: 0.85rem; border-radius: 8px; }

.btn-primary { background: var(--c-text-main); color: var(--c-bg); }
.btn-primary:hover { filter: brightness(1.15); }

.btn-secondary { background: var(--c-input-bg); color: var(--c-text-main); }
.btn-secondary:hover { background: #d8d8de; }

.btn-ghost { background: var(--c-input-bg); color: var(--c-text-main); }
.btn-ghost:hover { background: #d8d8de; }

.btn-danger { background: var(--c-red); color: white; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-success { background: var(--c-green); color: #1A1A1A; }
.btn-success:hover { filter: brightness(1.08); }

.btn-accent { background: var(--c-accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.1); }

/* ── HOME PANEL tlačítka: auto výška, zalamující text ── */
#profileBtnNew, #profileBtnPick {
    height: auto;
    min-height: 52px;
    padding: 10px 10px;
    text-align: center;
    line-height: 1.3;
    white-space: normal;
    word-break: keep-all;
}

/* ── SELECT OVERLAY WRAPPER: simuluje hover/active přes :has() ── */
#profileBtnPickWrap:has(select:focus) #profileBtnPick,
#profileBtnPickWrap:active #profileBtnPick {
    background: #d8d8de;
    transform: scale(0.96);
    filter: brightness(0.93);
}
#profileBtnPickWrap:hover #profileBtnPick {
    background: #d8d8de;
}

.btn-with-icon { display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-with-icon svg { stroke-width: 2.5px; }

.btn-close-abs {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--c-input-bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1rem;
    color: var(--c-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--trans-fast);
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.btn-close-abs:hover { background: var(--c-border); color: var(--c-text-main); }

/* ✅ TLAČÍTKO TUŽKY (vlevo nahoře v modálním okně) */
.btn-edit-abs {
    position: absolute;
    top: 16px;
    left: 16px;
    background: var(--c-input-bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--c-text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--trans-fast);
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.btn-edit-abs:hover { background: var(--c-border); }
.btn-edit-abs:active { transform: scale(0.9); }

.btn-edit-abs.active {
    background: var(--c-red);
    color: white;
}

.btn-icon-small {
    background: #E5E5EA;
    border: none;
    padding: 0;
    border-radius: 50%;
    color: var(--c-text-main);
    cursor: pointer;
    transition: var(--trans-fast);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-small:active { transform: scale(0.92); filter: brightness(0.95); }

/* ✅ MODIFIKÁTORY PRO IKONU ROČNÍHO PŘEHLEDU */
.btn-icon-small.inactive {
    background: var(--c-input-bg);
    color: var(--c-text-muted);
    cursor: default;
    opacity: 0.6;
}

.btn-icon-small.inactive:active {
    transform: none;
    filter: none;
}

.btn-icon-small.active {
    background: rgba(52, 199, 89, 0.15);
    color: #000000;
}

/* --- SYNC INDIKÁTOR (Admin) --- */
.sync-indicator {
    position: relative;
}

/* Rotating progress ring - zobrazí se při fetching */
.sync-btn.syncing::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(var(--c-green) 0deg, transparent 270deg);
    animation: syncSpin 0.8s linear infinite;
    z-index: 0;
    -webkit-mask: radial-gradient(circle, transparent 58%, black 60%);
    mask: radial-gradient(circle, transparent 58%, black 60%);
}

@keyframes syncSpin {
    to { transform: rotate(360deg); }
}

/* Ikona sync - rotace při fetching */
.sync-btn.syncing #syncIcon {
    animation: syncIconSpin 0.8s linear infinite;
}

@keyframes syncIconSpin {
    to { transform: rotate(360deg); }
}

/* Zelené pozadí po úspěšné sync */
.sync-btn.synced {
    background: rgba(52, 199, 89, 0.15);
    transition: background 0.3s ease;
}

/* Badge - červen dot pro nová data */
.sync-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--c-red, #FF3B30);
    border: 2px solid var(--c-bg);
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.btn-icon-circle {
    border: none;
    background-color: var(--c-input-bg);
    color: #000000;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--trans-fast);
}

.btn-icon-circle:active { transform: scale(0.92); background-color: #d1d1d6; }
.btn-icon-circle svg { width: 18px; height: 18px; stroke-width: 2px; }

/* --- 7b. LOADING OVERLAY (Mlha při server callu) --- */
#loadingOverlay {
  position: fixed;
  inset: 0;
  background: rgba(242, 242, 247, 0.65);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#loadingOverlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Spinner uvnitř overlay */
.overlay-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* --- 8. TOGGLES --- */
.toggle-switch {
    background: var(--c-input-bg);
    padding: 3px;
    border-radius: 8px;
    display: flex;
}

.toggle-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--c-text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--trans-fast);
}

.toggle-btn.active {
    background: var(--c-card);
    color: var(--c-text-main);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
/* --- PROFIL MODAL – PIN input s okem --- */
.pin-input-wrap {
  position: relative;
  flex: 1;
}
.pin-input-wrap .styled-input {
  width: 100%;
  padding-right: 38px;
  box-sizing: border-box;
}
.pin-eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}
.pin-eye-btn:active { color: var(--c-accent); }

/* --- PROFIL MODAL – Dimming efekt při editaci pole --- */
/* Plynulé přechody pro všechny potenciálně dimované prvky */
#profilePanelEdit #profileEmailRow,
#profilePanelEdit #profilePinRow,
#profilePanelEdit #profileMainSeparator,
#profilePanelEdit #profileBackBtn {
  transition: opacity 0.2s ease;
}
/* Při editaci PINu: potlač email řádek, separator a tlačítka */
#profilePanelEdit.editing-pin #profileEmailRow,
#profilePanelEdit.editing-pin #profileMainSeparator,
#profilePanelEdit.editing-pin #profileBackBtn {
  opacity: 0.18;
  pointer-events: none;
}
/* Při editaci emailu: potlač PIN řádek, separator a tlačítka */
#profilePanelEdit.editing-email #profilePinRow,
#profilePanelEdit.editing-email #profileMainSeparator,
#profilePanelEdit.editing-email #profileBackBtn {
  opacity: 0.18;
  pointer-events: none;
}

/* --- MODAL SPINNER (sdílená třída pro profileSpinner + bulkSpinner) --- */
.modal-spinner {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    border-radius: inherit;
    z-index: 10;
    align-items: center;
    justify-content: center;
}
