/* ============================================================
   QR Share System - Admin Backend Styles
   ============================================================ */

:root {
    --primary: #4A90D9;
    --primary-dark: #3A7BC8;
    --success: #27AE60;
    --danger: #E74C3C;
    --warning: #F39C12;
    --info: #3498DB;
    --secondary: #95A5A6;
    --dark: #2C3E50;
    --light: #ECF0F1;
    --bg: #F5F7FA;
    --sidebar-w: 220px;
    --text: #2C3E50;
    --text-muted: #7F8C8D;
    --border: #E0E6ED;
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
    background: #fff;
    padding: 40px 35px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 380px;
    max-width: 90%;
}
.login-box h1 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--dark);
}
.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 30px;
}
.login-box .form-group { margin-bottom: 20px; }
.login-box .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}
.login-box .form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
}
.login-box .form-group input:focus {
    outline: none;
    border-color: var(--primary);
}
.login-box .btn-login {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.login-box .btn-login:hover { background: var(--primary-dark); }
.login-error {
    background: #FDEDED;
    color: var(--danger);
    padding: 10px 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 13px;
    text-align: center;
}

/* ============================================================
   Layout
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--dark);
    color: #fff;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}
.sidebar .logo {
    padding: 20px 18px;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}
.sidebar .logo span { color: var(--primary); }
.sidebar nav { padding: 10px 0; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-left-color: var(--primary);
}
.sidebar nav a.active {
    color: #fff;
    background: rgba(74,144,217,0.15);
    border-left-color: var(--primary);
}
.sidebar nav a .icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    padding: 0 25px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .user-area { display: flex; align-items: center; gap: 15px; }
.topbar .user-area .username { font-size: 13px; color: var(--text-muted); }
.topbar .btn-logout {
    color: var(--danger);
    font-size: 13px;
}

.content-area { padding: 25px; flex: 1; }

/* ============================================================
   Cards & Stats
   ============================================================ */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
}
.stat-card .stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}
.stat-card .stat-icon.blue { background: var(--primary); }
.stat-card .stat-icon.green { background: var(--success); }
.stat-card .stat-icon.orange { background: var(--warning); }
.stat-card .stat-icon.purple { background: #9B59B6; }
.stat-card .stat-info .stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-card .stat-info .stat-label { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table th, table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
table th {
    background: var(--light);
    font-weight: 600;
    white-space: nowrap;
    color: var(--text);
}
table tbody tr:hover { background: #FAFBFC; }
table .actions { display: flex; gap: 8px; flex-wrap: nowrap; }
table img.thumb { width: 50px; height: 50px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #229954; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #C0392B; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #D68910; color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2980B9; color: #fff; }
.btn-default { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-default:hover { background: var(--light); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #D4EDDA; color: #155724; }
.badge-danger { background: #F8D7DA; color: #721C24; }
.badge-warning { background: #FFF3CD; color: #856404; }
.badge-info { background: #D1ECF1; color: #0C5460; }
.badge-secondary { background: #E2E3E5; color: #383D41; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}
.form-group label .required { color: var(--danger); }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: flex; gap: 20px; }
.form-row .form-group { flex: 1; }

/* ============================================================
   Color Picker
   ============================================================ */
.color-input-group { display: flex; align-items: center; gap: 10px; }
.color-input-group input[type="color"] {
    width: 50px; height: 38px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    padding: 2px;
}

/* ============================================================
   Filters / Toolbar
   ============================================================ */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}
.filter-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-group select, .filter-group input {
    padding: 7px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}
.filter-group select:focus, .filter-group input:focus { outline: none; border-color: var(--primary); }

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: #fff;
}
.pagination a:hover { background: var(--light); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 13px;
}
.alert-success { background: #D4EDDA; color: #155724; border: 1px solid #C3E6CB; }
.alert-danger { background: #F8D7DA; color: #721C24; border: 1px solid #F5C6CB; }
.alert-info { background: #D1ECF1; color: #0C5460; border: 1px solid #BEE5EB; }

/* ============================================================
   Image Grid (for image management)
   ============================================================ */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}
.image-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}
.image-card .img-container {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--light);
}
.image-card .img-container img {
    width: 100%; height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}
.image-card .img-container img:hover { transform: scale(1.05); }
.image-card .img-info {
    padding: 10px;
    font-size: 12px;
}
.image-card .img-info .img-type { color: var(--text-muted); }
.image-card .img-actions {
    display: flex;
    gap: 5px;
    padding: 0 10px 10px;
}
.image-card .checkbox-overlay {
    position: absolute;
    top: 8px; right: 8px;
    z-index: 5;
}

/* ============================================================
   QR Code Modal
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}
.modal-box h3 { margin-bottom: 15px; }
.modal-box .qr-img {
    margin: 15px auto;
    display: block;
}
.modal-box .modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.modal-close {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 15px; }
.empty-state .empty-text { font-size: 15px; margin-bottom: 15px; }

/* ============================================================
   Project Card
   ============================================================ */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.project-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.project-card .pc-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: start;
}
.project-card .pc-header h4 { font-size: 15px; }
.project-card .pc-body { padding: 15px 20px; }
.project-card .pc-body .info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
}
.project-card .pc-body .info-row .label { color: var(--text-muted); }
.project-card .pc-actions {
    padding: 12px 20px;
    background: var(--light);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .form-row { flex-direction: column; gap: 0; }
    .topbar .page-title { font-size: 14px; }
    .menu-toggle { display: block !important; }
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--dark);
}

/* ============================================================
   Misc
   ============================================================ */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-15 { margin-bottom: 15px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.flex { display: flex; }
.gap-10 { gap: 10px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.copy-input-group { display: flex; gap: 0; }
.copy-input-group input {
    flex: 1;
    padding: 7px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 13px;
}
.copy-input-group button {
    padding: 7px 15px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    font-size: 13px;
}
.copy-input-group button:hover { background: var(--primary-dark); }

/* ============================================================
   Image Uploader (配置图片上传控件)
   ============================================================ */
.img-uploader { width: 100%; }
.img-uploader .iu-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
}
.img-uploader .iu-text {
    flex: 1;
    min-width: 0;
    padding: 7px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}
.img-uploader .iu-text:focus { outline: none; border-color: var(--primary); }
.img-uploader .iu-btn-upload {
    white-space: nowrap;
    padding: 7px 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.img-uploader .iu-btn-upload:hover { background: var(--primary-dark); }
.img-uploader .iu-btn-upload.uploading { background: var(--secondary); cursor: wait; }
.img-uploader .iu-btn-clear {
    padding: 7px 12px;
    background: #fff;
    color: var(--danger);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
}
.img-uploader .iu-btn-clear:hover { border-color: var(--danger); background: #FDEDED; }
.img-uploader .iu-btn-clear:disabled { opacity: 0.4; cursor: not-allowed; }

/* 预览图 */
.img-uploader .iu-preview {
    display: none;
    position: relative;
    margin-top: 8px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 8px;
    background: #FAFBFC;
    text-align: center;
}
.img-uploader .iu-preview.show { display: block; }
.img-uploader .iu-preview .iu-img {
    max-width: 100%;
    max-height: 140px;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}
.img-uploader .iu-preview .iu-tip {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 上传进度条 */
.img-uploader .iu-progress {
    margin-top: 6px;
    height: 4px;
    background: var(--light);
    border-radius: 2px;
    overflow: hidden;
}
.img-uploader .iu-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.2s;
}
