/**
 * 悦·图床 YueAlbum - 设计系统
 * 配色清淡温柔，中度饱和红主色，清新淡雅
 */

/* ===== 变量 ===== */
:root {
    /* 主色系 - 中度饱和红，温柔不张扬 */
    --c-primary: #C8655E;
    --c-primary-dark: #B0544D;
    --c-primary-light: #D98E88;
    --c-primary-pale: #F2E0DE;
    --c-primary-ghost: #FBF4F3;

    /* 中性色 */
    --c-text: #3A3A3A;
    --c-text-secondary: #6B6B6B;
    --c-text-muted: #9E9E9E;
    --c-text-placeholder: #C4C4C4;

    /* 边框/背景 */
    --c-border: #E6DFDD;
    --c-border-light: #F0EBEA;
    --c-bg: #FBF9F8;
    --c-bg-secondary: #F5F1F0;
    --c-white: #FFFFFF;

    /* 功能色 */
    --c-success: #6BAF7A;
    --c-success-bg: #EEF7F0;
    --c-error: #D46B6B;
    --c-error-bg: #FDF2F2;
    --c-warning: #C99A52;
    --c-warning-bg: #FDF8EF;
    --c-info: #6B9CD4;
    --c-info-bg: #EEF4FB;

    /* 圆角 */
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    /* 阴影 */
    --shadow-xs: 0 1px 3px rgba(200,101,94,0.06);
    --shadow-sm: 0 2px 8px rgba(200,101,94,0.07);
    --shadow: 0 4px 16px rgba(200,101,94,0.08);
    --shadow-lg: 0 8px 32px rgba(200,101,94,0.1);
    --shadow-xl: 0 16px 48px rgba(200,101,94,0.14);

    /* 字号 */
    --text-xs: 11px;
    --text-sm: 12px;
    --text-base: 14px;
    --text-md: 15px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 22px;
    --text-3xl: 28px;

    /* 间距 */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* 过渡 */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 0.2s;
    --duration-slow: 0.35s;

    /* 布局 */
    --header-h: 60px;
    --sidebar-w: 240px;
    --content-max: 1200px;
}

/* ===== Reset ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--c-text);
    background: var(--c-bg);
    min-height: 100vh;
}

a {
    color: var(--c-primary);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}

a:hover {
    color: var(--c-primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
}

/* ===== 排版 ===== */
.h1, .h2, .h3, .h4 {
    font-weight: 600;
    color: var(--c-text);
    line-height: 1.3;
}

.h1 { font-size: var(--text-3xl); }
.h2 { font-size: var(--text-2xl); }
.h3 { font-size: var(--text-xl); }
.h4 { font-size: var(--text-lg); }

.text-sm { font-size: var(--text-sm); }
.text-muted { color: var(--c-text-muted); }
.text-secondary { color: var(--c-text-secondary); }
.text-primary { color: var(--c-primary); }
.text-center { text-align: center; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--c-primary);
    color: white;
    border-color: var(--c-primary);
}

.btn-primary:hover {
    background: var(--c-primary-dark);
    border-color: var(--c-primary-dark);
    box-shadow: 0 4px 14px rgba(200,101,94,0.3);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--c-primary);
    border-color: var(--c-primary-pale);
}

.btn-outline:hover {
    background: var(--c-primary-ghost);
    border-color: var(--c-primary-light);
    color: var(--c-primary-dark);
}

.btn-ghost {
    background: transparent;
    color: var(--c-text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--c-bg-secondary);
    color: var(--c-text);
}

.btn-danger {
    background: var(--c-error);
    color: white;
    border-color: var(--c-error);
}

.btn-danger:hover {
    background: #C05A5A;
    border-color: #C05A5A;
    color: white;
}

.btn-sm {
    height: 30px;
    padding: 0 14px;
    font-size: var(--text-xs);
}

.btn-lg {
    height: 46px;
    padding: 0 28px;
    font-size: var(--text-md);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-icon.sm {
    width: 28px;
    height: 28px;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--c-text);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--c-error);
    margin-left: 2px;
}

.form-label .hint {
    font-weight: 400;
    color: var(--c-text-muted);
    margin-left: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    color: var(--c-text);
    background: var(--c-white);
    outline: none;
    transition: border-color var(--duration), box-shadow var(--duration);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--c-primary-light);
    box-shadow: 0 0 0 3px var(--c-primary-pale);
}

.form-input::placeholder {
    color: var(--c-text-placeholder);
}

.form-textarea {
    height: auto;
    min-height: 80px;
    padding: 10px 12px;
    resize: vertical;
    line-height: 1.5;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239E9E9E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--c-text-secondary);
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    accent-color: var(--c-primary);
    width: 16px;
    height: 16px;
}

.form-row {
    display: flex;
    gap: var(--space-4);
}

.form-row > * {
    flex: 1;
}

.form-error {
    font-size: var(--text-xs);
    color: var(--c-error);
    margin-top: 4px;
}

/* ===== 卡片 ===== */
.card {
    background: var(--c-white);
    border-radius: var(--radius);
    border: 1px solid var(--c-border-light);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--duration-slow) var(--ease), transform var(--duration-slow) var(--ease);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-body {
    padding: var(--space-5);
}

.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--c-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--c-border-light);
}

/* ===== 标签 ===== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1.6;
}

.tag-primary {
    background: var(--c-primary-ghost);
    color: var(--c-primary);
}

.tag-success {
    background: var(--c-success-bg);
    color: var(--c-success);
}

.tag-warning {
    background: var(--c-warning-bg);
    color: var(--c-warning);
}

.tag-error {
    background: var(--c-error-bg);
    color: var(--c-error);
}

.tag-muted {
    background: var(--c-bg-secondary);
    color: var(--c-text-muted);
}

/* ===== 头像 ===== */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--c-primary-pale);
    color: var(--c-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--c-text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    opacity: 0.4;
}

.empty-state p {
    font-size: var(--text-sm);
    margin-top: var(--space-2);
}

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(58,58,58,0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-slow) var(--ease);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--c-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 680px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(12px) scale(0.97);
    transition: transform var(--duration-slow) var(--ease);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--c-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
}

/* 模态关闭按钮 */
.modal-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--c-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
    flex-shrink: 0;
}

.modal-close-btn:hover {
    background: var(--c-bg-secondary);
    color: var(--c-text);
}

.modal-close-btn:active {
    transform: scale(0.92);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--c-border-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    box-shadow: var(--shadow);
    animation: toastIn 0.3s var(--ease);
    max-width: 360px;
}

.toast-success {
    background: var(--c-success-bg);
    color: var(--c-success);
    border: 1px solid #C8E6C9;
}

.toast-error {
    background: var(--c-error-bg);
    color: var(--c-error);
    border: 1px solid #F8D7DA;
}

.toast-warning {
    background: var(--c-warning-bg);
    color: var(--c-warning);
    border: 1px solid #FFE0B2;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

/* ===== 表格 ===== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--c-border-light);
    white-space: nowrap;
}

td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--c-border-light);
    font-size: var(--text-sm);
    vertical-align: middle;
}

tr:hover td {
    background: var(--c-primary-ghost);
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: var(--space-6);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--c-text-secondary);
    transition: all var(--duration) var(--ease);
}

.pagination a:hover {
    background: var(--c-bg-secondary);
    color: var(--c-text);
}

.pagination .active {
    background: var(--c-primary);
    color: white;
    font-weight: 500;
}

/* ===== 工具类 ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 渐入动画 */
.fade-in {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 图片懒加载 */
.img-lazy {
    opacity: 0;
    transition: opacity 0.4s var(--ease);
}

.img-lazy.loaded {
    opacity: 1;
}

/* ===== 顶部导航（前台后台共用） ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: rgba(251,249,248,0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--c-border-light);
    z-index: 100;
    transition: box-shadow var(--duration-slow) var(--ease);
}

.site-header.scrolled {
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--c-primary);
}

.logo-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.logo-text {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* 搜索框（前台后台共用） */
.search-box {
    position: relative;
}

.search-box input {
    height: 34px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    width: 200px;
    outline: none;
    background: var(--c-white);
    color: var(--c-text);
    transition: all var(--duration) var(--ease);
}

.search-box input::placeholder {
    color: var(--c-text-placeholder);
}

.search-box input:focus {
    border-color: var(--c-primary-light);
    box-shadow: 0 0 0 3px var(--c-primary-pale);
    width: 260px;
}

.search-box svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--c-text-muted);
    pointer-events: none;
}

/* ===== 响应式 ===== */
/* 移动端菜单按钮（前台后台共用） */
.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--c-text-secondary);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: var(--c-bg-secondary);
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    :root {
        --header-h: 52px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .modal {
        width: 95%;
        max-height: 90vh;
    }

    .hide-mobile { display: none !important; }
    .mobile-menu-btn { display: flex; }
}

@media (max-width: 480px) {
    .btn-lg {
        height: 42px;
    }
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--c-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--c-text-muted);
}

/* ===== 选择高亮 ===== */
::selection {
    background: var(--c-primary-pale);
    color: var(--c-primary-dark);
}
