/* 中一照片直播 - Reusable Components */

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); padding: var(--space-2) var(--space-4);
  border: none; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); border-color: var(--text-sub); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }
.btn-ghost { background: transparent; color: var(--text-sub); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: 16px; }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: 13px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm); }

/* ============== INPUTS ============== */
.form-group { margin-bottom: var(--space-5); }
.form-label { display: block; margin-bottom: var(--space-2); font-size: 14px; font-weight: 500; color: var(--text); }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--surface); transition: var(--transition);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-hint { margin-top: var(--space-1); font-size: 12px; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

/* ============== CARDS ============== */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.card-header { padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 16px; font-weight: 600; }
.card-body { padding: var(--space-6); }

/* ============== TAGS ============== */
.tag { display: inline-flex; align-items: center; padding: 2px var(--space-2); border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.tag-success { background: #D1FAE5; color: #065F46; }
.tag-warning { background: #FEF3C7; color: #92400E; }
.tag-danger { background: #FEE2E2; color: #991B1B; }
.tag-info { background: var(--primary-light); color: var(--primary); }
.tag-default { background: var(--bg); color: var(--text-sub); }

/* ============== TABLES ============== */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: var(--space-4); text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-sub); background: var(--bg); }
.data-table td { font-size: 14px; }
.data-table tr:hover td { background: var(--bg); }
.table-actions { display: flex; gap: var(--space-2); }
.activity-thumb { width: 60px; height: 45px; border-radius: var(--radius-sm); object-fit: cover; background: var(--bg); }

/* ============== STAT CARDS ============== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); margin-bottom: var(--space-8); }
.stat-card { background: var(--surface); border-radius: var(--radius-lg); padding: var(--space-6); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.stat-value { font-size: 32px; font-weight: 700; line-height: 1.2; margin-bottom: var(--space-1); }
.stat-label { font-size: 14px; color: var(--text-sub); }
.stat-change { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 500; margin-top: var(--space-2); }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============== UPLOAD AREA ============== */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: var(--space-12); text-align: center; cursor: pointer; transition: var(--transition); background: var(--bg); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-icon { width: 64px; height: 64px; margin: 0 auto var(--space-4); color: var(--text-muted); }
.upload-text { font-size: 16px; font-weight: 500; margin-bottom: var(--space-1); }
.upload-hint { font-size: 13px; color: var(--text-sub); }

/* ============== PHOTO GRID ============== */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-4); }
.photo-item { position: relative; aspect-ratio: 4/3; border-radius: var(--radius-md); overflow: hidden; cursor: pointer; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.photo-item:hover img { transform: scale(1.05); }
.photo-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%); opacity: 0; transition: var(--transition); display: flex; align-items: flex-end; padding: var(--space-3); }
.photo-item:hover .photo-overlay { opacity: 1; }
.photo-actions { display: flex; gap: var(--space-2); }
.photo-check { position: absolute; top: var(--space-2); right: var(--space-2); width: 24px; height: 24px; background: rgba(255,255,255,0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; opacity: 0; transition: var(--transition); z-index: 2; }
.photo-item:hover .photo-check, .photo-item.selected .photo-check { opacity: 1; }
.photo-index { position: absolute; top: var(--space-2); left: var(--space-2); min-width: 22px; height: 22px; padding: 0 6px; background: rgba(0,0,0,0.6); color: #fff; border-radius: 11px; font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; z-index: 2; pointer-events: none; }
.photo-item.selected { outline: 3px solid var(--primary); outline-offset: 2px; }
.photo-item[draggable="true"] { cursor: grab; }
.photo-item[draggable="true"]:active { cursor: grabbing; }
.photo-item.dragging { opacity: 0.4; outline: 2px dashed var(--primary); outline-offset: 2px; }
.photo-item.drag-over { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ============== MODAL ============== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: none; align-items: center; justify-content: center; padding: var(--space-4); }
.modal-overlay.active { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius-xl); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: var(--space-6); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close { width: 32px; height: 32px; border: none; background: transparent; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-sub); transition: var(--transition); }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: var(--space-6); }
.modal-footer { padding: var(--space-5) var(--space-6); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--space-3); }

/* ============== TOAST ============== */
.toast-container { position: fixed; top: var(--space-6); right: var(--space-6); z-index: 300; display: flex; flex-direction: column; gap: var(--space-3); }
.toast { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-lg); border-left: 4px solid var(--success); display: flex; align-items: center; gap: var(--space-3); animation: slideIn 0.3s ease; min-width: 300px; }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============== EMPTY STATE ============== */
.empty-state { text-align: center; padding: var(--space-12); }
.empty-icon { width: 80px; height: 80px; margin: 0 auto var(--space-4); color: var(--text-muted); }
.empty-title { font-size: 18px; font-weight: 600; margin-bottom: var(--space-2); }
.empty-desc { color: var(--text-sub); margin-bottom: var(--space-6); }

/* ============== WATERMARK PREVIEW ============== */
.watermark-preview { width: 100%; aspect-ratio: 16/9; background: linear-gradient(135deg, var(--bg), white); border-radius: var(--radius-md); border: 1px solid var(--border); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.watermark-preview-text { position: absolute; font-size: 24px; font-weight: 600; color: rgba(0,0,0,0.1); transform: rotate(-30deg); pointer-events: none; }

/* ============== SWITCH TOGGLE ============== */
.switch { position: relative; width: 44px; height: 24px; background: var(--border); border-radius: 12px; cursor: pointer; transition: var(--transition); flex-shrink: 0; }
.switch.active { background: var(--primary); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: white; border-radius: 50%; transition: var(--transition); box-shadow: var(--shadow-sm); }
.switch.active::after { left: 22px; }

/* ============== PROGRESS BAR ============== */
.progress-bar { width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); transition: width 0.2s ease; }
.progress-bar-fill.complete { background: var(--success); }
.progress-bar-fill.processing { background: var(--warning); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ============== SPINNER ============== */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============== MISC ============== */
.mobile-menu-btn { display: none; width: 40px; height: 40px; border: none; background: transparent; border-radius: var(--radius-sm); cursor: pointer; align-items: center; justify-content: center; color: var(--text); }
