/* ══════════════════════════════════════════════════════════════
   Settings page  (prefix: st-)
   Shared across all settings tabs: General, Working Hours,
   Branding, Locations, Departments, Shifts, GPS & WFH
   ══════════════════════════════════════════════════════════════ */

/* Animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Page header ───────────────────────────────────────────── */

.st-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.st-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px 0;
}

.st-subtitle {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

/* ── Tab bar ───────────────────────────────────────────────── */

.st-tabs {
    display: flex;
    border-bottom: 1px solid #E5E7EB;
    margin-bottom: 24px;
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 0;
}

.st-tabs::-webkit-scrollbar { display: none; }

.st-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    white-space: nowrap;
    margin-bottom: -1px;
    transition: color 150ms, border-color 150ms;
    flex-shrink: 0;
    font-family: inherit;
}

.st-tab:hover { color: #111827; }

.st-tab--active {
    color: #111827;
    font-weight: 600;
    border-bottom-color: #6366F1;
}

/* ── Loading card shell (used in Settings.razor directly) ── */

.st-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}

/* ── Buttons ───────────────────────────────────────────────── */

.st-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #6366F1;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms;
    font-family: inherit;
}

.st-btn-primary:hover:not(:disabled) { background: #4F46E5; }
.st-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.st-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: transparent;
    color: #374151;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms;
    font-family: inherit;
}

.st-btn-ghost:hover { background: #F9FAFB; }

.st-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: transparent;
    color: #EF4444;
    border: 1px solid #EF4444;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms, color 150ms;
    font-family: inherit;
}

.st-btn-danger:hover {
    background: #EF4444;
    color: #FFFFFF;
}

/* ── Spinner ───────────────────────────────────────────────── */

.st-spin {
    animation: spin 1s linear infinite;
}

.st-loading-icon {
    color: #6B7280;
}

/* ── Toast notification ────────────────────────────────────── */

.st-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

.st-toast--success {
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #6EE7B7;
}

.st-toast--error {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

.st-toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 150ms;
    display: flex;
    align-items: center;
}

.st-toast-close:hover { opacity: 1; }

/* ── Loading / error states ────────────────────────────────── */

.st-loading-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    gap: 12px;
}

.st-loading-text {
    color: #6B7280;
    font-size: 14px;
    margin: 0;
}

.st-error-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    gap: 8px;
}

.st-error-msg {
    color: #DC2626;
    font-size: 14px;
    margin: 0;
}

.st-error-center .st-btn-ghost {
    margin-top: 8px;
}

/* ── Placeholder tab ───────────────────────────────────────── */

.st-placeholder {
    color: #9CA3AF;
    font-size: 14px;
    padding: 40px 0;
    text-align: center;
}

/* ── Toggle switch (used in GPS & WFH tab) ─────────────────── */

.st-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid #F3F4F6;
}

.st-toggle-row:last-child { border-bottom: none; }

.st-toggle-info { flex: 1; min-width: 0; }

.st-toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 2px;
}

/* A setting the workspace's plan does not include (same look as the sidebar's plan badge). */
.st-plan-badge {
    margin-left: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #fff;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
}

.st-toggle-desc {
    font-size: 12px;
    color: #6B7280;
}

.st-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-left: 16px;
}

.st-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.st-toggle-slider {
    position: absolute;
    inset: 0;
    background: #D1D5DB;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 200ms;
}

.st-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #FFFFFF;
    border-radius: 50%;
    transition: transform 200ms;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.st-toggle input:checked + .st-toggle-slider {
    background: #6366F1;
}

.st-toggle input:checked + .st-toggle-slider::before {
    transform: translateX(20px);
}

/* ── GPS & WFH tab ─────────────────────────────────────────── */

.gw-max-wfh-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #F3F4F6;
}

.gw-number-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    flex-shrink: 0;
    padding-top: 8px;
    min-width: 180px;
}

.gw-number-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gw-number-input {
    width: 100px;
    padding: 8px 10px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #FFFFFF;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 150ms;
}

.gw-number-input:focus { border-color: #6366F1; }

.gw-number-hint {
    font-size: 12px;
    color: #6B7280;
}

/* ── Mobile ────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .st-card { padding: 16px; }
    .st-tab { padding: 10px 12px; font-size: 13px; }

    .st-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .st-header-actions {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .gw-max-wfh-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        min-width: 0;
    }

    .gw-max-wfh-row label {
        min-width: 0;
    }

    .st-form-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Manager visibility card sits above the departments grid (ManagerScopeCard.razor). */
.dash-card-mb {
    margin-bottom: 1.5rem;
}

/* Data & privacy tab */
.st-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 0.75rem 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.st-notice {
    border: 1px solid var(--border, #e5e7eb);
    border-left: 3px solid #000;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.st-notice p {
    margin: 0;
    font-size: 0.875rem;
}

@media (max-width: 640px) {
    .st-form-grid {
        grid-template-columns: 1fr;
    }
}
