/* =============================================================
   app-base.css  —  全站通用样式（替代各页面的重复 @layer utilities）
   生成来源：staff-engineer-mode 重构扫描（2026-09-03）
   说明：所有 @apply 类均已解糖为标准 CSS，无需依赖 tailwindcss CDN @layer 编译。
   ============================================================= */

/* ---------- 1. content-visibility (曾经 @layer .content-auto) ---------- */
.content-auto {
    content-visibility: auto;
}

/* ---------- 2. 侧边栏项目（index & admin 共用基本骨架；各页面独立样式覆盖差异放 page-*.css）---------- */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* 12px */
    padding: 0.625rem 1rem; /* py-2.5 px-4 */
    border-radius: 0.5rem; /* rounded-lg */
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
    font-size: 0.875rem; /* 14px text-sm */
    color: #4b5563; /* text-gray-600 */
}
.sidebar-item:hover {
    background-color: #eff6ff; /* bg-primary-50 */
    color: #1d4ed8; /* text-primary-700 */
}
.sidebar-item-active {
    background-image: linear-gradient(to right, #2563eb, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(59,130,246,0.25), 0 2px 4px -2px rgba(59,130,246,0.1); /* shadow-md shadow-primary-500/25 */
}
.sidebar-item-active:hover {
    background-image: linear-gradient(to right, #1d4ed8, #1e40af);
    color: #ffffff;
}
/* move.php 深色 sidebar （独立条目）*/
.sidebar-item-inactive {
    color: #94a3b8; /* slate-400 */
}
.sidebar-item-inactive:hover {
    background-color: rgba(51,65,85,0.5); /* slate-700/50 */
    color: #e2e8f0; /* slate-200 */
}

/* ---------- 2.5 全站 Logo：容器 + 图片（index / login / register / admin 预览共用）
   由 js/app-common.js::applyLogoGlobal() 根据 data-logo-* 注入 --logo-h / --logo-min-h
   保证即使 Tailwind CDN 未加载也按后台设置尺寸显示。 --------------------- */
.site-logo-wrap {
    min-width: 0;
    min-height: var(--logo-min-h, 0px);
}
.site-logo-img {
    display: block;
    height: var(--logo-h, 40px);
    max-width: 180px;
    width: auto;
    object-fit: contain;
    object-position: center;
    aspect-ratio: auto;
}

/* ---------- 3. 按钮：.btn-primary / .btn-danger / .btn-secondary / .btn-success
   —— 不同页面 padding 稍有差异，这里给出基础骨架，页面级覆盖用 page-*.css ---------- */
.btn-primary,
.btn-danger,
.btn-secondary,
.btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;       /* py-2 px-4 基础：index/admin 共用 */
    border-radius: 0.5rem;       /* rounded-lg 基础 */
    font-weight: 500;
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4,0,0.2,1);
    transition-duration: 200ms;
    line-height: 1.25rem;
    text-decoration: none;        /* 防 a 标签下划线 */
    border: 1px solid transparent;
    cursor: pointer;
}
.btn-primary:active,
.btn-danger:active,
.btn-secondary:active,
.btn-success:active {
    transform: scale(0.98);
}
.btn-primary {
    background-image: linear-gradient(to right, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 1px 2px 0 rgba(59,130,246,0.2); /* shadow-sm shadow-primary-500/20 */
}
.btn-primary:hover {
    background-image: linear-gradient(to right, #1d4ed8, #1e40af);
    box-shadow: 0 4px 6px -1px rgba(59,130,246,0.3); /* hover:shadow-md shadow-primary-500/30 */
}
.btn-danger {
    background-image: linear-gradient(to right, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 1px 2px 0 rgba(239,68,68,0.2);
}
.btn-danger:hover {
    background-image: linear-gradient(to right, #dc2626, #b91c1c);
    box-shadow: 0 4px 6px -1px rgba(239,68,68,0.3);
}
.btn-secondary {
    background-color: #ffffff;
    border-color: #e5e7eb;
    color: #374151;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
.btn-secondary:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
}
.btn-success {
    background-image: linear-gradient(to right, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 1px 2px 0 rgba(34,197,94,0.2);
}
.btn-success:hover {
    background-image: linear-gradient(to right, #16a34a, #15803d);
}

/* ---------- 4. 输入框：.input-field (基础骨架) ---------- */
.input-field, .form-input, .input-x {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #ffffff;
    transition: all 200ms cubic-bezier(0.4,0,0.2,1);
    outline: none;
    color: #111827;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.25rem;
}
.input-field::placeholder,
.form-input::placeholder,
.input-x::placeholder {
    color: #9ca3af;
}
.input-field:focus,
.form-input:focus,
.input-x:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.25rem rgba(59,130,246,0.2);
}
.input-x {
    background-color: #f9fafb;
    border-radius: 0.75rem;
    padding: 0.625rem 0.875rem;
}
.form-input {
    background-color: rgba(249,250,251,0.5);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
}
.form-input:focus {
    background-color: #fff;
    box-shadow: 0 0 0 0.25rem rgba(59,130,246,0.3);
}
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* ---------- 5. 表格骨架：.table-header / .table-row / .table-cell ---------- */
.table-header {
    background-image: linear-gradient(to right, #f9fafb, #f8fafc);
    color: #4b5563;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.table-row {
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 150ms;
}
.table-row:hover {
    background-color: rgba(239,246,255,0.3);
}
.table-cell {
    padding: 0.75rem 1rem;
}

/* ---------- 6. .card / .section-title ---------- */
.card {
    background-color: #fff;
    border-radius: 0.75rem;
    /* --tw-shadow-card 在 tailwind.config 扩展；这里给等价兜底： */
    box-shadow: 0 4px 16px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.03);
}
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---------- 7. .expired / .expiring-soon ---------- */
.expired {
    color: #ef4444;
    font-weight: 600;
}
.expiring-soon {
    color: #f59e0b;
    font-weight: 600;
}

/* ---------- 8. 侧边栏滚动条隐藏（index/admin 共用）---------- */
.sidebar-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
}
.sidebar-scroll {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* ---------- 9. 搜索框图标/清除定位（index 用）---------- */
.search-input {
    padding-left: 2.75rem !important;
    padding-right: 2.5rem !important;
}
.search-icon {
    left: 0.875rem !important;
    z-index: 2;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}
.search-clear {
    right: 0.75rem !important;
    z-index: 2;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    background: transparent;
    border: none;
    color: #9ca3af;
    padding: 2px 4px;
}
.search-clear:hover { color: #374151; }

/* ---------- 10. 上传表单 grid 布局（index 用）---------- */
.upload-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
    align-items: end;
}
@media (max-width: 1024px) {
    .upload-form {
        grid-template-columns: 1fr;
    }
}
.upload-form .full-width {
    grid-column: 1 / -1;
}

/* ---------- 11. <input type=date> 选择器美化（全端）---------- */
input[type="date"] {
    position: relative;
    min-height: 2.25rem;
}
input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0.6;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: opacity 0.2s, background 0.2s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background: #f3f4f6;
}

/* ---------- 12. 认证页面背景 + 装饰圆斑（login/register/move/rename 共用）---------- */
body.auth-page-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: "Noto Sans SC", system-ui, sans-serif;
}
.auth-bg-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    filter: blur(40px);
    pointer-events: none;
}

/* ---------- 13. 滑块验证（login/register 用）---------- */
.slider-container {
    position: relative;
    width: 100%;
    height: 40px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    transition: border-color 0.2s;
}
.slider-container:hover {
    border-color: #cbd5e1;
}
.slider-track {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(to right, #dbeafe, #bfdbfe);
    border-radius: 8px;
    transition: none;
}
.slider-track.success {
    background: linear-gradient(to right, #bbf7d0, #86efac);
}
.slider-track.fail {
    background: linear-gradient(to right, #fecaca, #fca5a5);
}
.slider-button {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 38px;
    height: 32px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.15s ease;
    z-index: 2;
}
.slider-button:active {
    cursor: grabbing;
    transform: scale(1.02);
}
.slider-button:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}
.slider-button.success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: #22c55e;
    color: #fff;
}
.slider-button.fail {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #ef4444;
    color: #fff;
}
.slider-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: #94a3b8;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1;
    font-weight: 500;
}
.slider-text.success { color: #16a34a; }
.slider-text.fail    { color: #dc2626; }
.slider-target-hint {
    position: absolute;
    top: 0;
    height: 100%;
    width: 3px;
    background: linear-gradient(to bottom, #3b82f6, #2563eb);
    z-index: 0;
    opacity: 0.6;
    border-radius: 2px;
}
.slider-msg {
    font-size: 12px;
    margin-top: 8px;
    min-height: 18px;
    transition: color 0.3s;
}
.slider-msg.error   { color: #ef4444; }
.slider-msg.success { color: #22c55e; }

/* ---------- 14. .btn-back (preview 用) ---------- */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #fff;
    color: #374151;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 200ms;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
    text-decoration: none;
}
.btn-back:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

/* ---------- 15. util-* 由 style= 属性抽离的公共工具类 ---------- */
.util-logo-minw0      { min-width: 0; }
.util-logo-img       { max-width: 180px; object-fit: contain; }
.util-logo-img-login { max-height: 64px; max-width: 200px; object-fit: contain; }
.util-logo-img-reg   { max-height: 96px; max-width: 220px; object-fit: contain; }
.util-minw-120       { min-width: 120px; }
.util-display-none   { display: none !important; }

/* Install page background helper (配合 body class) */
body.install-page-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}
.install-spin { animation: install-fa-spin 1s linear infinite; }
@keyframes install-fa-spin {
    to { transform: rotate(360deg); }
}
.install-step-dot { transition: all .3s; }

/* move.php 的自定义下拉箭头 (svg data uri) */
.util-caret-select {
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 fill=%27none%27 viewBox=%270 0 24 24%27 stroke=%27%236b7280%27%3E%3Cpath stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272%27 d=%27M19 9l-7 7-7-7%27/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    appearance: none;
    padding-right: 2.25rem;
}
