/**
 * ZmCloud 管理后台 - 高端暗色主题样式表
 */

/* ========== CSS 变量 ========== */
:root {
    --bg-primary:    #0a0a0f;
    --bg-secondary:  #111118;
    --bg-card:       #17171f;
    --bg-hover:      #1f1f2e;
    --bg-sidebar:    #0e0e16;
    --gold:          #c9a84c;
    --gold-light:    #e8c97a;
    --gold-dark:     #a07830;
    --blue:          #4f8ef7;
    --blue-dark:     #2d6ce0;
    --text-primary:  #f0ede6;
    --text-secondary:#a89f8a;
    --text-muted:    #5a5468;
    --border:        rgba(255, 255, 255, 0.07);
    --border-hover:  rgba(201, 168, 76, 0.3);
    --shadow-card:   0 4px 24px rgba(0, 0, 0, 0.4);
    --radius:        12px;
    --radius-sm:     8px;
    --transition:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== 基础样式 ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* ========== 登录页 ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(201, 168, 76, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 60% at 20% 80%, rgba(79, 142, 247, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 44px 40px;
    border: 1px solid rgba(201, 168, 76, 0.15);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 60px rgba(201, 168, 76, 0.05);
    animation: loginCardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(32px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo img {
    height: 56px;
    width: auto;
}

.login-logo .logo-placeholder {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.05em;
}

.login-header h1 {
    font-size: 22px;
    margin-top: 14px;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.06em;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 13px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text-primary);
    transition: all var(--transition);
    font-family: inherit;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--bg-hover);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

.form-group select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group small {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-login {
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: #1a1400;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.08em;
    margin-top: 4px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(201, 168, 76, 0.4);
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
}

.btn-login:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    margin-top: 22px;
}

.login-footer a {
    color: var(--gold);
    text-decoration: none;
    font-size: 13px;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.login-footer a:hover {
    opacity: 1;
}

/* ========== 警告框 ========== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(46, 160, 67, 0.1);
    color: #5fbf6a;
    border-color: rgba(46, 160, 67, 0.2);
}

.alert-danger {
    background: rgba(200, 50, 50, 0.1);
    color: #e07070;
    border-color: rgba(200, 50, 50, 0.2);
}

.alert-warning {
    background: rgba(201, 168, 76, 0.1);
    color: var(--gold-light);
    border-color: rgba(201, 168, 76, 0.2);
}

.alert-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* ========== 管理后台布局 ========== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow: hidden;
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--gold) 30%, var(--gold) 70%, transparent);
    opacity: 0.15;
    pointer-events: none;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar-logo img {
    height: 38px;
    width: auto;
}

.sidebar-title {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    margin: 1px 8px;
    border-radius: var(--radius-sm);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(201, 168, 76, 0.1);
    color: var(--gold-light);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--gold);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    width: 28px;
    font-size: 17px;
    flex-shrink: 0;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 4px 0;
}

.logout {
    color: rgba(200, 80, 80, 0.7) !important;
}

.logout:hover {
    color: #e07070 !important;
    background: rgba(200, 80, 80, 0.08) !important;
}

/* ========== 主内容区 ========== */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px 30px;
    background: var(--bg-primary);
}

.main-content-inner {
    min-width: 1080px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.content-header h1 {
    font-size: 22px;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-header h1::before {
    content: '';
    width: 4px;
    height: 22px;
    background: var(--gold);
    border-radius: 2px;
    display: inline-block;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-role {
    padding: 4px 12px;
    background: rgba(201, 168, 76, 0.15);
    color: var(--gold-light);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ========== 按钮 ========== */
.btn {
    padding: 9px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: #1a1400;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    box-shadow: 0 4px 16px rgba(201, 168, 76, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

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

.btn-danger {
    background: rgba(200, 50, 50, 0.15);
    color: #e07070;
    border: 1px solid rgba(200, 50, 50, 0.2);
}

.btn-danger:hover {
    background: rgba(200, 50, 50, 0.25);
    box-shadow: 0 4px 16px rgba(200, 50, 50, 0.2);
    transform: translateY(-1px);
}

.btn-blue {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
    color: #fff;
}

.btn-blue:hover {
    box-shadow: 0 4px 16px rgba(79, 142, 247, 0.3);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 5px;
}

.readonly-input {
    background-color: var(--bg-secondary) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
}

.btn-icon {
    padding: 5px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    transition: transform var(--transition);
    color: var(--text-muted);
}

.btn-icon:hover {
    transform: scale(1.2);
    color: var(--text-primary);
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(201, 168, 76, 0.1);
    border: 1px solid rgba(201, 168, 76, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ========== 卡片 ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--gold);
    border-radius: 2px;
    display: inline-block;
}

.card-body {
    padding: 24px;
}

/* ========== 搜索/筛选区 ========== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all var(--transition);
}

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.1);
}

.filter-bar select option {
    background: var(--bg-card);
}

/* ========== 表格 ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 15px;
    text-align: left;
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.data-table td {
    padding: 13px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ========== 徽章 ========== */
.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    display: inline-block;
}

.badge-primary {
    background: rgba(201, 168, 76, 0.15);
    color: var(--gold-light);
    border: 1px solid rgba(201, 168, 76, 0.2);
}

.badge-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge-success {
    background: rgba(46, 160, 67, 0.12);
    color: #5fbf6a;
    border: 1px solid rgba(46, 160, 67, 0.2);
}

.badge-danger {
    background: rgba(200, 50, 50, 0.12);
    color: #e07070;
    border: 1px solid rgba(200, 50, 50, 0.2);
}

/* ========== Modal ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid rgba(201, 168, 76, 0.15);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(201, 168, 76, 0.03);
}

.modal-header h3 {
    font-size: 17px;
    color: var(--text-primary);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}

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

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.modal-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: rgba(0, 0, 0, 0.1);
}

/* ========== 表单行 ========== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.empty-message {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
    font-size: 15px;
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 20px;
    border-top: 1px solid var(--border);
}

.pagination a,
.pagination span {
    padding: 7px 13px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    border: 1px solid transparent;
}

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

.pagination a:hover {
    color: var(--gold-light);
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.pagination .current {
    color: #1a1400;
    background: var(--gold);
    font-weight: 700;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .main-content-inner {
        min-width: unset;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* ========== 其他工具类 ========== */
.text-gold {
    color: var(--gold);
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: #5fbf6a;
}

.text-danger {
    color: #e07070;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

.copy-btn {
    cursor: pointer;
    color: var(--gold);
    font-size: 13px;
    background: none;
    border: none;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition);
    font-family: inherit;
}

.copy-btn:hover {
    background: rgba(201, 168, 76, 0.1);
}
