/* ========== Navigation Bar ========== */

.admin-nav {
    background: #1e293b;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.admin-nav-brand {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.admin-nav-brand:hover {
    opacity: 0.85;
    text-decoration: none;
}

.admin-nav-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-nav-user {
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    margin-right: 6px;
    padding-right: 10px;
    border-right: 1px solid rgba(255,255,255,0.12);
}

.admin-nav-actions .btn {
    padding: 7px 16px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: transparent;
    color: rgba(255,255,255,0.8);
    line-height: 1.5;
}

.admin-nav-actions .btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}

.admin-nav-actions .btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.admin-nav-actions .btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

@media (max-width: 768px) {
    .admin-nav { padding: 0 16px; }
}

@media (max-width: 600px) {
    .admin-nav-actions .btn-outline { display: none; }
    .admin-nav-user { display: none; }
}

/* ========== Stats Grid ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

.stat-card {
    background: var(--card);
    padding: 20px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-hint);
}

@media (max-width: 480px) {
    .stat-card { padding: 18px 20px; }
    .stat-card .stat-value { font-size: 24px; }
}

/* ========== Section Header ========== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ========== Table ========== */

.config-table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.config-table {
    width: 100%;
    border-collapse: collapse;
}

.config-table th,
.config-table td {
    padding: 12px 18px;
    text-align: left;
    font-size: 14px;
    line-height: 1.5;
}

.config-table thead {
    border-bottom: 1px solid var(--border);
}

.config-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    padding-top: 14px;
    padding-bottom: 14px;
}

.config-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
}

.config-table tbody tr:last-child {
    border-bottom: none;
}

.config-table tbody tr:hover {
    background: #f8fafc;
}

.config-table .col-app {
    min-width: 160px;
}

.config-table .col-slug {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.config-table .col-actions {
    width: 1%;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .config-table th,
    .config-table td {
        padding: 10px 14px;
        font-size: 13px;
    }
    .hide-mobile { display: none; }
}

/* ========== Icon Thumbnail ========== */

.icon-thumb {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 10px;
    display: inline-block;
    background: #f0f0f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.icon-thumb-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f3f4f6;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

/* ========== Badge ========== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    gap: 4px;
}

.badge-locked {
    background: #fef3c7;
    color: #92400e;
}

.badge-open {
    background: #d1fae5;
    color: #065f46;
}

/* ========== Actions Cell ========== */

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

.actions-cell .btn {
    padding: 5px 12px;
    font-size: 13px;
    border-radius: 5px;
}

/* ========== Download Link Box ========== */

.download-link-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    word-break: break-all;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.download-link-box .copy-btn {
    margin-left: auto;
    flex: none;
}

/* ========== Download Page ========== */

.download-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.download-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.download-card .app-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: cover;
    margin: 0 auto 20px;
    display: block;
    background: #f3f4f6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.download-card .app-icon-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: #f3f4f6;
    margin: 0 auto 20px;
}

.download-card h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.download-card .app-version {
    font-size: 14px;
    color: var(--text-hint);
    margin-bottom: 4px;
}

.download-card .app-developer {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.download-card .app-description {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 28px;
}

.download-card .btn-download {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius);
}

.download-card .form-hint {
    font-size: 13px;
    color: var(--text-hint);
    margin-top: 16px;
    line-height: 1.5;
}

.download-card .form-group input[type="password"] {
    text-align: center;
    font-size: 17px;
    letter-spacing: 4px;
}

@media (max-width: 480px) {
    .download-card { padding: 28px 20px; border-radius: 12px; }
    .download-card .app-icon,
    .download-card .app-icon-placeholder { width: 68px; height: 68px; border-radius: 18px; }
    .download-card h1 { font-size: 20px; }
}

/* ========== Upload Zone ========== */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    margin-bottom: 24px;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
    background: #fafafa;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone-dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone-icon {
    margin-bottom: 16px;
    color: var(--text-hint);
}

.upload-zone-text {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-zone-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

.upload-zone-hint {
    font-size: 13px;
    color: var(--text-hint);
}

/* ========== Upload Info ========== */

.upload-info {
    margin-bottom: 24px;
}

.upload-info-file {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.upload-info-icon {
    flex: none;
    color: var(--text-hint);
}

.upload-info-detail {
    flex: 1;
    min-width: 0;
}

.upload-info-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
    line-height: 1.4;
}

.upload-info-size {
    display: block;
    font-size: 13px;
    color: var(--text-hint);
    margin-top: 2px;
}

/* ========== Upload Progress ========== */

.upload-progress-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 16px;
}

.upload-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s ease;
    border-radius: 4px;
}

.upload-progress-pct {
    font-size: 14px;
    color: var(--text-secondary);
    width: 40px;
    text-align: right;
    flex: none;
}

/* ========== Upload Result ========== */

.upload-result {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 16px;
}

.upload-result-icon {
    flex: none;
    display: flex;
    align-items: center;
}

.upload-result-text {
    font-size: 14px;
    font-weight: 500;
}

.upload-info-actions {
    margin-top: 16px;
}

/* ========== File Type Icon & Badge ========== */

.file-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    margin-right: 8px;
    flex: none;
}

.file-type-icon.badge-apk {
    background: #e8f5e9;
    color: #2e7d32;
}

.file-type-icon.badge-mc {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-apk {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-mc {
    background: #e3f2fd;
    color: #1565c0;
}

/* ========== Danger Button ========== */

.btn-danger {
    color: var(--danger) !important;
    border-color: var(--danger-border) !important;
}

.btn-danger:hover {
    background: var(--danger-bg) !important;
    color: var(--danger-text) !important;
}

/* ========== Login Page ========== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8ecf1 100%);
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.login-header p {
    font-size: 15px;
    color: var(--text-secondary);
}

.login-card .btn-login {
    width: 100%;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 8px;
    border-radius: var(--radius);
}

.login-hint {
    text-align: center;
    font-size: 13px;
    color: var(--text-hint);
    margin-top: 20px;
}

/* ========== Sidebar Layout ========== */

.admin-body {
    min-height: 100vh;
    background: var(--bg);
}

.admin-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.admin-sidebar {
    width: 232px;
    flex: none;
    background: #1e293b;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand a {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.sidebar-brand a:hover {
    color: #93c5fd;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 16px;
}

.sidebar-section {
    padding: 18px 12px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.38);
    text-transform: uppercase;
    white-space: nowrap;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin: 2px 0;
    border-radius: 7px;
    font-size: 14px;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}

.sidebar-link.active {
    background: rgba(37, 99, 235, 0.85);
    color: #fff;
    font-weight: 600;
}

.sidebar-icon {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex: none;
    background: rgba(255,255,255,0.25);
    font-size: 0;
    line-height: 0;
}

.sidebar-link.active .sidebar-icon {
    background: #fff;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-user {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    font-size: 13px;
    color: #fca5a5;
    text-decoration: none;
    flex: none;
}

.sidebar-logout:hover {
    color: #fecaca;
    text-decoration: underline;
}

.admin-main {
    flex: 1;
    min-width: 0;
    padding: 28px 32px 40px;
}

.admin-main .container {
    max-width: 1120px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .admin-sidebar { width: 200px; }
    .admin-main { padding: 20px 16px 32px; }
    .sidebar-section { padding-left: 8px; padding-right: 8px; }
    .sidebar-link { padding: 8px 10px; font-size: 13px; }
}

/* 窄屏：侧边栏折叠为顶部横向导航 */
@media (max-width: 600px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 4px;
    }
    .sidebar-brand {
        padding: 4px 10px 4px 4px;
        border-bottom: none;
        border-right: 1px solid rgba(255,255,255,0.12);
        margin-right: 4px;
    }
    .sidebar-brand a { font-size: 14px; }
    .sidebar-nav {
        flex: none;
        display: flex;
        flex-wrap: wrap;
        gap: 2px;
        padding: 0;
        overflow: visible;
    }
    .sidebar-section { display: none; }
    .sidebar-link {
        margin: 0;
        padding: 6px 10px;
        font-size: 13px;
        border-radius: 6px;
    }
    .sidebar-icon { display: none; }
    .sidebar-footer { display: none; }
    .admin-main { padding: 16px 12px 28px; }
}
