/**
 * Faetu UI 通用组件样式
 * 依赖 static/css/faetu.css 中的设计变量，供各业务页面共享。
 */

/* ------------------------------ Toast ------------------------------ */
.faetu-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.faetu-toast {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
    max-width: 380px;
    padding: 12px 18px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    animation: faetuToastIn 0.28s ease;
    pointer-events: auto;
}

.faetu-toast-success { background: var(--qmtink-success); }
.faetu-toast-error   { background: var(--qmtink-error); }
.faetu-toast-warning { background: var(--qmtink-warning); }
.faetu-toast-info    { background: var(--qmtink-info); }

.faetu-toast-out {
    animation: faetuToastOut 0.3s ease forwards;
}

@keyframes faetuToastIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

@keyframes faetuToastOut {
    from { transform: translateX(0);     opacity: 1; }
    to   { transform: translateX(110%);  opacity: 0; }
}

/* ------------------------------ Modal ------------------------------ */
.faetu-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    animation: faetuFadeIn 0.18s ease;
}

.faetu-modal-box {
    width: 100%;
    max-width: 460px;
    background: var(--qmtink-bg-primary);
    border-radius: 12px;
    padding: 22px 24px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
    animation: faetuScaleIn 0.18s ease;
}

.faetu-modal-title {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--qmtink-text-primary);
}

.faetu-modal-body {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--qmtink-text-secondary);
}

.faetu-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@keyframes faetuFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes faetuScaleIn {
    from { transform: scale(0.94); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* ------------------------------ 表格 / 分页 ------------------------------ */
.faetu-table-empty td {
    padding: 40px 0 !important;
    text-align: center;
    color: var(--qmtink-text-muted);
    font-size: 14px;
}

.faetu-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 4px 4px;
}

.faetu-pagination-info {
    font-size: 13px;
    color: var(--qmtink-text-secondary);
}

.faetu-pagination-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.faetu-pagination-nav .btn.active {
    background: var(--qmtink-primary);
    border-color: var(--qmtink-primary);
    color: #fff;
}

/* ------------------------------ 加载态 ------------------------------ */
.faetu-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 0;
    color: var(--qmtink-text-muted);
    font-size: 14px;
}

.faetu-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--qmtink-border);
    border-top-color: var(--qmtink-primary);
    border-radius: 50%;
    animation: faetuSpin 0.8s linear infinite;
}

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

/* ================================================================
   滚动条统一美化
   —— 覆盖桌面壳、后台框架、以及桌面应用窗口（iframe）内的全部管理页；
      深色 / 科技主题由各自更高优先级的规则覆盖。
   ================================================================ */

html {
    scrollbar-width: thin;
    scrollbar-color: #c7d2e1 transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c7d2e1;
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* 深色主题 */
:root[theme="dark"] html {
    scrollbar-color: #475569 transparent;
}

:root[theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569;
    background-clip: padding-box;
}

:root[theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
    background-clip: padding-box;
}

/* ------------------------------ 中英文切换 ------------------------------ */
.lang-switch-holder { display: inline-flex; align-items: center; }

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--qmtink-border);
    background: var(--qmtink-bg-primary);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
}

.lang-switch .lang-opt {
    padding: 3px 7px;
    border: none;
    background: none;
    border-radius: 999px;
    font: inherit;
    font-size: 12px;
    line-height: 1;
    color: var(--qmtink-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.lang-switch .lang-opt:hover { color: var(--qmtink-primary); }

.lang-switch .lang-opt.active {
    background: var(--qmtink-primary);
    color: var(--qmtink-primary-text);
    font-weight: 600;
}

.lang-switch .lang-sep { color: var(--qmtink-text-muted); font-size: 11px; }