/* CentraMEDKIT Admin Settings — Modern UI */

/* Override login.css body styles (login.css sets display:flex/padding on body
   which pushes the dashboard container inward and creates a gap beside the sidebar) */
body {
    display: block !important;
    align-items: unset !important;
    justify-content: unset !important;
    padding: 0 !important;
    background: #f8fafc !important;
}

:root {
    --st-ink: #0f172a;
    --st-ink-700: #334155;
    --st-ink-500: #64748b;
    --st-ink-400: #94a3b8;
    --st-line: #e2e8f0;
    --st-line-strong: #cbd5e1;
    --st-brand: #2563eb;
    --st-brand-700: #1d4ed8;
    --st-brand-50: #eff6ff;
}

/* Header */

.dashboard-header {
    position: sticky;
    top: 56px;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1.25rem 2rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.dashboard-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--st-ink);
    margin: 0;
}

.dashboard-subtitle {
    font-size: 0.85rem;
    color: var(--st-ink-500);
    margin: 0.2rem 0 0;
}

/* Settings card */

.settings-card {
    margin: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

/* Tabs */

.settings-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--st-line);
    background: rgba(248, 250, 252, 0.8);
    overflow-x: auto;
    scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar {
    display: none;
}

.settings-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 0.95rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--st-ink-500);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-tab:hover {
    color: var(--st-ink);
    background: rgba(15, 23, 42, 0.04);
}

.settings-tab.active {
    color: var(--theme-accent, var(--st-brand-700));
    border-bottom-color: var(--theme-accent, var(--st-brand));
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.settings-tab .tab-icon {
    display: inline-flex;
}

.settings-tab .tab-icon svg {
    width: 16px;
    height: 16px;
}

/* Panels */

.settings-tab-content {
    display: none;
    padding: 1.75rem;
}

.settings-tab-content.active {
    display: block;
    animation: stFadeIn 0.3s ease;
}

.settings-form {
    display: grid;
    gap: 1.5rem;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--st-ink);
    margin: 0 0 0.25rem;
}

.section-sub {
    font-size: 0.85rem;
    color: var(--st-ink-500);
    margin: 0 0 1.25rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--st-ink-700);
}

.req {
    color: #ef4444;
}

.input,
.select,
.textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--st-ink);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--theme-accent, var(--st-brand));
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.textarea {
    resize: vertical;
    min-height: 90px;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--st-ink-400);
}

/* Toggle rows */

.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    background: rgba(37, 99, 235, 0.03);
    border: 1px solid rgba(37, 99, 235, 0.08);
    border-radius: 10px;
}

.toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--theme-accent, var(--st-brand));
    cursor: pointer;
    flex: none;
}

.toggle-row label {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--st-ink-700);
    cursor: pointer;
}

/* Info boxes */

.info-box {
    border: 1px solid rgba(37, 99, 235, 0.08);
    border-left: 4px solid var(--theme-accent, var(--st-brand));
    background: rgba(37, 99, 235, 0.03);
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.success-box {
    border: 1px solid rgba(16, 185, 129, 0.08);
    border-left: 4px solid #10b981;
    background: rgba(16, 185, 129, 0.03);
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.warning-box {
    border: 1px solid rgba(245, 158, 11, 0.08);
    border-left: 4px solid #f59e0b;
    background: rgba(245, 158, 11, 0.03);
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.danger-box {
    border: 1px solid rgba(239, 68, 68, 0.08);
    border-left: 4px solid #ef4444;
    background: rgba(239, 68, 68, 0.03);
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.info-box strong,
.success-box strong,
.warning-box strong,
.danger-box strong {
    color: var(--st-ink);
}

/* Previews */

.preview {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--theme-accent, var(--st-brand-700));
    background: rgba(37, 99, 235, 0.04);
    border: 1px dashed rgba(37, 99, 235, 0.2);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-top: 0.5rem;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--theme-accent, linear-gradient(135deg, #2563eb, #1e40af)) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.2) !important;
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3) !important;
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}

.btn-ghost {
    background: #fff;
    color: var(--st-ink-500);
    border: 1px solid var(--st-line-strong);
}

.btn-ghost:hover {
    color: var(--st-ink);
    border-color: var(--st-ink-400);
}

.btn-sm {
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

/* Tax list */

.tax-list {
    border: 1px solid var(--st-line);
    border-radius: 12px;
    overflow: hidden;
}

.tax-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--st-line);
}

.tax-list-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--st-ink);
}

.tax-list-body {
    max-height: 380px;
    overflow-y: auto;
}

.tax-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--st-line);
    transition: background 0.15s ease;
}

.tax-item:last-child {
    border-bottom: none;
}

.tax-item:hover {
    background: rgba(15, 23, 42, 0.02);
}

.tax-item-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--st-ink);
}

.badge {
    background: #10b981;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.tax-item-meta {
    font-size: 0.8rem;
    color: var(--st-ink-500);
    margin-top: 0.2rem;
}

.tax-item-actions {
    display: flex;
    gap: 0.5rem;
    flex: none;
}

.empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--st-ink-500);
}

.empty-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 0.75rem;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--st-brand);
}

.empty-icon svg {
    width: 22px;
    height: 22px;
}

/* Modal */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 20, 45, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-overlay.open {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 80px -20px rgba(2, 24, 72, 0.4);
    padding: 1.75rem;
    animation: stModalIn 0.25s ease;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.modal-head h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--st-ink);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--st-ink-400);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease;
}

.modal-close:hover {
    color: var(--st-ink);
    background: rgba(15, 23, 42, 0.05);
}

.modal-form {
    display: grid;
    gap: 1.25rem;
}

/* Toast */

.toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%) translateY(-16px);
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: min(92vw, 460px);
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    background: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 16px 40px rgba(2, 24, 72, 0.25);
    animation: stToastIn 0.3s ease forwards;
}

.toast.success {
    border: 1px solid #a7f3d0;
    color: #047857;
}

.toast.error {
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.toast-icon {
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.toast.success .toast-icon {
    background: #ecfdf5;
    color: #10b981;
}

.toast.error .toast-icon {
    background: #fef2f2;
    color: #ef4444;
}

.toast-icon svg {
    width: 12px;
    height: 12px;
}

.toast.hide {
    animation: stToastOut 0.3s ease forwards;
}

/* Animations */

@keyframes stFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes stModalIn {
    from {
        transform: translateY(16px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

@keyframes stToastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes stToastOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-16px);
    }
}

/* Responsive */

@media (max-width: 768px) {
    .dashboard-header {
        position: static;
    }

    .settings-card {
        margin: 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .settings-tab-content {
        padding: 1.25rem;
    }

    .tax-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
