/* =====================================================================
   Dockyfy — Settings Page (Module 28)
   CSS namespace: st-*
   Two-tab layout: App Settings (admin grouped view) | My Preferences (user)
   ===================================================================== */

/* ── Page wrapper ───────────────────────────────────────────────────── */
.st-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Tab strip ──────────────────────────────────────────────────────── */
.st-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #2d3748;
    margin-bottom: .25rem;
}

.st-tab {
    padding: .65rem 1.4rem;
    font-size: .875rem;
    font-weight: 500;
    color: #94a3b8;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.st-tab:hover { color: #f1f5f9; }

.st-tab.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
}

/* ── Component filter pills (App Settings tab) ──────────────────────── */
.st-comp-pills {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.st-comp-pill {
    padding: .35rem .85rem;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 500;
    border: 1px solid #2d3748;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all .15s;
}

.st-comp-pill:hover { border-color: #6366f1; color: #f1f5f9; }
.st-comp-pill.active { background: #6366f1; border-color: #6366f1; color: #fff; }

/* ── Error / empty banners ──────────────────────────────────────────── */
.st-error {
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.3);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    color: #fca5a5;
    font-size: .875rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.st-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
    font-size: .9rem;
}

.st-empty .material-symbols-outlined {
    font-size: 2.5rem;
    display: block;
    margin: 0 auto .75rem;
    color: #334155;
}

/* ── Skeleton shimmer ───────────────────────────────────────────────── */
.st-skeleton {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.st-skel-group {
    background: #1e293b;
    border-radius: 10px;
    padding: 1.25rem;
}

.st-skel-title {
    height: 14px;
    width: 120px;
    background: linear-gradient(90deg, #2d3748 25%, #374151 50%, #2d3748 75%);
    background-size: 200% 100%;
    animation: st-shimmer 1.4s infinite;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.st-skel-row {
    height: 44px;
    background: linear-gradient(90deg, #2d3748 25%, #374151 50%, #2d3748 75%);
    background-size: 200% 100%;
    animation: st-shimmer 1.4s infinite;
    border-radius: 6px;
    margin-bottom: .5rem;
}

@keyframes st-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Category group ─────────────────────────────────────────────────── */
.st-group {
    background: #1e293b;
    border: 1px solid #2d3748;
    border-radius: 10px;
    overflow: hidden;
}

.st-group-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .85rem 1.25rem;
    background: #162032;
    border-bottom: 1px solid #2d3748;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #94a3b8;
}

.st-group-header .material-symbols-outlined {
    font-size: 1.1rem;
    color: #6366f1;
}

/* ── Setting row ────────────────────────────────────────────────────── */
.st-row {
    display: grid;
    grid-template-columns: 1fr 260px 80px;
    align-items: center;
    gap: 1rem;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid #1a2536;
    transition: background .12s;
}

.st-row:last-child { border-bottom: none; }
.st-row:hover { background: rgba(99,102,241,.04); }

.st-row-label {
    min-width: 0;
}

.st-key {
    font-size: .845rem;
    font-weight: 500;
    color: #e2e8f0;
    margin-bottom: .2rem;
    font-family: 'Fira Code', 'Consolas', monospace;
}

.st-desc {
    font-size: .78rem;
    color: #64748b;
    line-height: 1.4;
}

.st-badge-system {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .7rem;
    font-weight: 600;
    padding: .15rem .5rem;
    border-radius: 10px;
    background: rgba(245,158,11,.1);
    color: #fbbf24;
    margin-top: .3rem;
}

.st-badge-overridable {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .7rem;
    font-weight: 600;
    padding: .15rem .5rem;
    border-radius: 10px;
    background: rgba(16,185,129,.1);
    color: #34d399;
    margin-top: .3rem;
    margin-left: .3rem;
}

.st-row-control {
    display: flex;
    align-items: center;
}

/* text / int inputs */
.st-input {
    width: 100%;
    padding: .45rem .75rem;
    background: #0f172a;
    border: 1px solid #2d3748;
    border-radius: 6px;
    color: #f1f5f9;
    font-size: .85rem;
    outline: none;
    transition: border-color .15s;
}

.st-input:focus { border-color: #6366f1; }
.st-input[type=number] { width: 90px; }

/* select */
.st-select {
    width: 100%;
    min-width: 160px;
    padding: .45rem .75rem;
    background: #0f172a;
    border: 1px solid #2d3748;
    border-radius: 6px;
    color: #f1f5f9;
    font-size: .85rem;
    outline: none;
    cursor: pointer;
    transition: border-color .15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .6rem center;
    padding-right: 2rem;
}

.st-select:focus { border-color: #6366f1; }

/* bool toggle */
.st-toggle-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.st-toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

.st-toggle input { opacity: 0; width: 0; height: 0; }

.st-toggle-slider {
    position: absolute;
    inset: 0;
    background: #2d3748;
    border-radius: 20px;
    cursor: pointer;
    transition: background .2s;
}

.st-toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 14px;
    height: 14px;
    background: #94a3b8;
    border-radius: 50%;
    transition: transform .2s, background .2s;
}

.st-toggle input:checked + .st-toggle-slider { background: #6366f1; }
.st-toggle input:checked + .st-toggle-slider::before { transform: translateX(18px); background: #fff; }

.st-toggle-label { font-size: .8rem; color: #94a3b8; }

/* action column */
.st-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
}

.st-save-btn {
    padding: .35rem .7rem;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity .15s;
    white-space: nowrap;
}

.st-save-btn:hover:not(:disabled) { opacity: .85; }
.st-save-btn:disabled { opacity: .45; cursor: not-allowed; }

.st-save-btn.saving {
    opacity: .6;
    cursor: not-allowed;
}

/* ── User Preferences tab ───────────────────────────────────────────── */
.st-user-row {
    display: grid;
    grid-template-columns: 1fr 260px 100px;
    align-items: center;
    gap: 1rem;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid #1a2536;
    transition: background .12s;
}

.st-user-row:last-child { border-bottom: none; }
.st-user-row:hover { background: rgba(99,102,241,.04); }

.st-override-indicator {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    font-size: .7rem;
    color: #6366f1;
    font-weight: 600;
    margin-top: .25rem;
}

.st-default-indicator {
    font-size: .7rem;
    color: #475569;
    margin-top: .25rem;
}

.st-reset-btn {
    padding: .35rem .65rem;
    background: transparent;
    color: #94a3b8;
    border: 1px solid #2d3748;
    border-radius: 6px;
    font-size: .78rem;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: .25rem;
}

.st-reset-btn:hover { border-color: #ef4444; color: #f87171; }

/* ── Toast notification ─────────────────────────────────────────────── */
.st-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    background: #1e293b;
    border: 1px solid #2d3748;
    border-radius: 10px;
    padding: .9rem 1.25rem;
    font-size: .875rem;
    color: #f1f5f9;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 260px;
    max-width: 420px;
    animation: st-toast-in .2s ease;
}

.st-toast.success { border-left: 3px solid #10b981; }
.st-toast.error   { border-left: 3px solid #ef4444; }

.st-toast .material-symbols-outlined { font-size: 1.1rem; }
.st-toast.success .material-symbols-outlined { color: #10b981; }
.st-toast.error   .material-symbols-outlined { color: #ef4444; }

@keyframes st-toast-in {
    from { opacity: 0; transform: translateY(.5rem); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .st-row, .st-user-row {
        grid-template-columns: 1fr;
        gap: .6rem;
    }

    .st-row-actions, .st-user-row > :last-child {
        justify-content: flex-start;
    }

    .st-input[type=number] { width: 100%; }
}
