/* ── Settings / Department — chrome común de los paneles ────────────────────
   Header, barra de tabs, dropdowns de filtro y botones de tabla. Lo consume
   SettingsPanelHeader / SettingsTabsBar / SettingsFilterDropdown.

   Va global (y no en un .razor.css) porque los paneles inyectan botones vía
   RenderFragment: ese markup lleva el scope del padre, no el del componente. */

/* ── Header ────────────────────────────────────────────────────────────── */

.sd-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.sd-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sd-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #333;
    margin: 0;
}

.sd-subtitle {
    font-size: 0.85rem;
    color: #8898AA;
    margin: 0;
}

.sd-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px;
    flex-wrap: wrap;
}

/* ── Buscador ──────────────────────────────────────────────────────────── */

.sd-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.sd-search-box svg {
    position: absolute;
    left: 14px;
    color: #8898AA;
}

.sd-search-box input {
    padding: 10px 14px 10px 38px;
    border: 1px solid #E0E0E0;
    border-radius: 24px;
    outline: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    width: 250px;
    max-width: 200px;
}

.sd-search-box input:focus {
    border-color: #FF00FF;
    border-width: 2px;
    padding: 9px 13px 9px 37px;
}

/* ── Toggle tarjetas / tabla ───────────────────────────────────────────── */

.sd-view-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #E4E8EE;
    background-color: #ffffff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sd-view-toggle-btn:hover,
.sd-view-toggle-btn.active {
    background-color: #fdf1fa;
    color: #d33bb2;
    border-color: #f0c6e6;
}

/* ── Botón de alta ─────────────────────────────────────────────────────── */

.sd-add-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #FF00FF;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 0, 255, 0.3);
    flex-shrink: 0;
}

.sd-add-btn:hover {
    background: #E600E6;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 0, 255, 0.4);
}

/* ── Barra de tabs ─────────────────────────────────────────────────────── */

.sd-tabs-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-bottom: 5px;
    border-bottom: 1.5px solid #E2E8F0;
}

.sd-tabs-scroll {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    flex: 1 1 0;
    min-width: 0;
}

.sd-tabs-row {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    flex: 1 1 0;
    width: 0;
    min-width: 0;
}

.sd-tabs-row::-webkit-scrollbar {
    display: none;
}

.sd-tabs-filters,
.sd-tabs-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sd-tabs-actions-right {
    gap: 4px;
}

.sd-scroll-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #E0E0E0;
    background: #F5F5F5;
    color: #8898AA;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    z-index: 2;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.sd-scroll-btn:hover {
    background: #E8EBF2;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.sd-scroll-btn.left {
    margin-right: 6px;
}

.sd-scroll-btn.right {
    margin-left: 6px;
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.sd-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 20px;
    border-radius: 25px;
    border: 2px solid #E0E0E0;
    background: #fff;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.9rem;
    font-weight: 600;
    color: #8898AA;
    white-space: nowrap;
    flex-shrink: 0;
}

.sd-tab:hover {
    border-color: #FFC107;
    color: #555;
}

.sd-tab.active {
    border-color: #FFC107;
    background: #FFF8E1;
    color: #333;
}

.sd-tab-label {
    font-weight: 700;
}

.sd-tab-count {
    font-weight: 800;
    font-size: 1.05rem;
    color: #333;
}

.sd-tab.active .sd-tab-count {
    color: #E6A200;
}

/* ── Dropdown de filtro ────────────────────────────────────────────────── */

.sd-dropdown {
    position: relative;
    flex-shrink: 0;
}

/* Abierto, el disparador tiene que quedar por encima del backdrop: si no, el backdrop lo tapa y
   el clic para cerrar nunca llega al botón. */
.sd-dropdown.open {
    z-index: 100;
}

.sd-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 16px;
    border-radius: 25px;
    border: 2px solid #E0E0E0;
    background: #fff;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.85rem;
    font-weight: 600;
    color: #8898AA;
    white-space: nowrap;
    height: 42px;
    max-width: 200px;
}

.sd-dropdown-btn > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sd-dropdown-btn:hover,
.sd-dropdown-btn.active {
    border-color: #FFC107;
    color: #333;
}

.sd-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    padding: 6px;
    min-width: 210px;
    width: max-content;
    max-width: 280px;
    max-height: 260px;
    overflow-y: auto;
}

.sd-dropdown-option {
    text-align: left;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    min-height: 34px;
    line-height: 1.4;
    display: flex;
    align-items: center;
}

.sd-dropdown-option:hover {
    background: #F5F5F5;
}

.sd-dropdown-option.active {
    background: #FFF8E1;
    color: #333;
}

.sd-dropdown-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
    border-radius: 6px;
}

.sd-dropdown-spinner {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    border: 2px solid #f3c9ea;
    border-top-color: #d33bb2;
    border-radius: 50%;
    animation: sd-spin 0.7s linear infinite;
}

@keyframes sd-spin {
    to { transform: rotate(360deg); }
}

/* Captura el clic fuera para cerrar los menús abiertos. */
.sd-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
    background: transparent;
}

/* ── Botones ghost de la derecha (Auto-ajustar / Limpiar filtros) ───────── */

.sd-tbl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748B;
    height: 36px;
    white-space: nowrap;
}

.sd-tbl-btn:hover {
    background: #F1F5F9;
    color: #1E293B;
}

.sd-tbl-btn.clear {
    color: #94A3B8;
}

.sd-tbl-btn.clear:hover {
    background: #FEF2F2;
    color: #EF4444;
}
