/* ===== CSS Variables ===== */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --bg: #f9fafb;
    --bg-card: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #fff; border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--border-light); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-block { width: 100%; }
.btn-large { padding: 12px 28px; font-size: 15px; }

/* ===== Top Navigation ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 28px;
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}
.logo {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.user-info {
    color: var(--text-secondary);
    font-size: 13px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== Toolbar ===== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    flex-wrap: wrap;
}
.breadcrumb-item {
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.breadcrumb-item:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.breadcrumb-sep { color: var(--text-muted); font-size: 12px; }
.toolbar-actions { display: flex; gap: 8px; }
.search-box { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 320px; margin: 0 16px; }
.search-input {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    background: var(--bg);
}
.search-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.search-status { font-weight: 500; }

/* ===== Upload Queue ===== */
.upload-queue {
    padding: 0 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}
.upload-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.upload-item:last-child { border-bottom: none; }
.upload-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text);
}
.upload-progress-bar {
    width: 180px;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}
.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.upload-status {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 50px;
    text-align: right;
}

/* ===== File List ===== */
.file-list-container {
    margin: 20px 28px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.file-table { width: 100%; border-collapse: collapse; }
.file-table th {
    background: var(--bg);
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.file-table td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}
.file-table tbody tr {
    transition: background 0.15s;
}
.file-table tbody tr:hover { background: #f8faff; }
.file-table tbody tr:last-child td { border-bottom: none; }
.col-size { width: 100px; color: var(--text-secondary); }
.col-download { width: 80px; color: var(--text-muted); font-size: 13px; text-align: center; }
.col-time { width: 170px; color: var(--text-muted); font-size: 13px; }
.col-actions { width: 260px; text-align: right; }
.file-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.file-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
}
.file-name { color: var(--text); font-weight: 500; }
.folder .file-name { color: var(--primary); }
.file-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}
.status-pending { background: #fef3c7; color: #d97706; }
.status-rejected { background: #fee2e2; color: #dc2626; }
.file-owner {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    background: var(--primary-light);
    color: var(--primary);
    margin-left: 8px;
    vertical-align: middle;
    font-weight: 500;
}
.action-btns { display: flex; gap: 5px; justify-content: flex-end; }
.action-btn {
    padding: 5px 11px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
    font-weight: 500;
}
.action-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}
.action-btn.danger:hover {
    background: #fef2f2;
    color: var(--danger);
    border-color: #fecaca;
}
.loading { text-align: center; color: var(--text-muted); padding: 48px !important; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-muted);
}
.empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.6; }
.empty-state p { font-size: 15px; }
.empty-tip { font-size: 13px; margin-top: 6px; color: var(--text-muted); }

/* ===== Modals ===== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(17, 24, 39, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 440px;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.25s ease;
}
.modal-large { width: 680px; }
.modal-small { width: 380px; }
.modal-content h3 {
    margin-bottom: 20px;
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Form Elements ===== */
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #fff;
    color: var(--text);
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

/* ===== Share Result ===== */
.share-result {
    margin-top: 18px;
    padding: 16px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    border: 1px solid #c7d2fe;
}
.share-result label { color: var(--primary); font-weight: 600; }
.share-link-box { display: flex; gap: 8px; margin-top: 8px; }
.share-link-box input { flex: 1; background: #fff; }

/* ===== Shares List ===== */
.shares-list { max-height: 420px; overflow-y: auto; }
.share-item {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: all 0.15s;
}
.share-item:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.share-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.share-item-name { font-weight: 600; color: var(--text); font-size: 14px; }
.share-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.8;
}
.share-item-url { display: flex; gap: 8px; align-items: center; }
.share-item-url input { flex: 1; font-size: 12px; padding: 7px 10px; }
.share-item-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    background: var(--text);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 500;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* ===== Auth Page ===== */
.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}
.auth-body::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    top: -200px; right: -100px;
}
.auth-body::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
    bottom: -150px; left: -100px;
}
.auth-container { width: 100%; max-width: 420px; padding: 20px; position: relative; z-index: 1; }
.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.auth-card h1 {
    text-align: center;
    font-size: 22px;
    color: var(--text);
    margin-bottom: 6px;
    font-weight: 700;
}
.auth-card h2 {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: normal;
    margin-bottom: 28px;
}
.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Share Page ===== */
.share-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eefc 100%);
}
.share-container { width: 100%; max-width: 500px; padding: 20px; }
.share-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 44px 36px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.lock-icon { font-size: 52px; margin-bottom: 18px; }
.file-icon-large { font-size: 68px; margin-bottom: 18px; }
.share-file-name {
    font-size: 19px;
    color: var(--text);
    margin-bottom: 18px;
    word-break: break-all;
    font-weight: 600;
}
.share-meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}
.share-tip { margin-top: 18px; font-size: 12px; color: var(--text-muted); }

/* ===== Profile Page ===== */
.profile-container { max-width: 580px; margin: 40px auto; padding: 0 20px; }
.profile-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.profile-card h2 { margin-bottom: 28px; color: var(--text); font-size: 20px; }
.profile-section {
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border-light);
}
.profile-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.profile-section h3 { font-size: 16px; color: var(--text); margin-bottom: 16px; font-weight: 600; }
.current-username {
    display: inline-block;
    background: var(--primary-light);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 14px;
    font-size: 13px;
}
.back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.back-link:hover { color: var(--primary); text-decoration: none; }

/* ===== Admin Page ===== */
.admin-wrap { max-width: 1140px; margin: 0 auto; padding: 24px; }
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.admin-header h1 { font-size: 22px; color: var(--text); font-weight: 700; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    text-align: center;
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-num { font-size: 30px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.stat-card.warning .stat-num { color: var(--warning); }
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--border);
}
.tab {
    padding: 14px 26px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    font-weight: 500;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content {
    display: none;
    background: var(--bg-card);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-top: none;
}
.tab-content.active { display: block; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    background: var(--bg);
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.admin-table tr:hover { background: #f8faff; }
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-admin { background: #fef3c7; color: #d97706; }
.badge-user { background: var(--primary-light); color: var(--primary); }
.badge-active { background: #d1fae5; color: #059669; }
.badge-disabled { background: #fee2e2; color: #dc2626; }
.badge-pending { background: #fef3c7; color: #d97706; }
.badge-approved { background: #d1fae5; color: #059669; }
.row-actions { display: flex; gap: 6px; }
.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}
.btn-sm:hover { transform: translateY(-1px); }
.btn-sm-primary { background: var(--primary); color: #fff; }
.btn-sm-warn { background: var(--warning); color: #fff; }
.btn-sm-danger { background: var(--danger); color: #fff; }
.btn-sm-success { background: var(--success); color: #fff; }
.empty-tip { text-align: center; padding: 40px; color: var(--text-muted); }

/* ===== Clean Page ===== */
.clean-wrap { max-width: 660px; margin: 40px auto; padding: 0 20px; }
.clean-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.clean-card h1 { font-size: 21px; color: var(--text); margin-bottom: 8px; }
.clean-card .subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}
.stat-box {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 18px;
    text-align: center;
    border: 1px solid var(--border-light);
}
.stat-box .num { font-size: 22px; font-weight: 700; color: var(--primary); }
.stat-box .label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.clean-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 16px;
    transition: all 0.15s;
}
.clean-section:hover { box-shadow: var(--shadow-sm); }
.clean-section h3 { font-size: 15px; margin-bottom: 8px; color: var(--text); }
.clean-section p { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; }
.clean-section.danger { border-color: #fecaca; background: #fef2f2; }
.clean-section.danger h3 { color: var(--danger); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .toolbar { flex-direction: column; gap: 14px; align-items: flex-start; }
    .search-box { max-width: 100%; margin: 0; width: 100%; }
    .col-time { display: none; }
    .col-download { display: none; }
    .col-actions { width: auto; }
    .file-list-container { margin: 12px; }
    .topbar { padding: 0 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .admin-wrap { padding: 14px; }
    .modal-content { padding: 20px; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
