/* Apple Admin - 仿Koi-UI风格 */
:root {
  --primary-color: #409eff;
  --success-color: #67c23a;
  --warning-color: #e6a23c;
  --danger-color: #f56c6c;
  --info-color: #909399;
  --bg-color: #f0f2f5;
  --sidebar-bg: #001529;
  --sidebar-width: 220px;
  --header-height: 60px;
  --text-color: #303133;
  --text-secondary: #909399;
  --border-color: #dcdfe6;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--text-color);
  background-color: var(--bg-color);
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

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

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: width 0.3s;
}

.sidebar-logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo img {
  height: 32px;
  margin-right: 10px;
}

.sidebar-logo h1 {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}

/* Menu */
.sidebar-menu {
  padding: 10px 0;
}

.menu-item {
  display: block;
  padding: 14px 20px;
  color: rgba(255,255,255,0.7);
  transition: all 0.3s;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.menu-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.menu-item.active {
  color: #fff;
  background: var(--primary-color);
  border-left-color: #fff;
}

.menu-item i {
  margin-right: 10px;
  font-size: 16px;
}

.menu-group-title {
  padding: 10px 20px 5px;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  text-transform: uppercase;
}

/* Main Content */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

/* Header */
.admin-header {
  height: var(--header-height);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 99;
}

.header-left {
  display: flex;
  align-items: center;
}

.breadcrumb {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
}

.breadcrumb span {
  margin: 0 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-info {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
}

/* Content */
.admin-content {
  flex: 1;
  padding: 20px;
}

/* Card */
.card {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.05);
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
  gap: 5px;
}

.btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-primary {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.btn-primary:hover {
  background: #66b1ff;
  border-color: #66b1ff;
  color: #fff;
}

.btn-success {
  background: var(--success-color);
  border-color: var(--success-color);
  color: #fff;
}

.btn-danger {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: #fff;
}

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

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  background: #fafafa;
  font-weight: 600;
  color: var(--text-color);
}

.table tr:hover {
  background: #f5f7fa;
}

/* Form */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-inline {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-inline .form-group {
  margin-bottom: 0;
}

/* Status Tags */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.tag-success {
  background: #f0f9eb;
  color: var(--success-color);
}

.tag-danger {
  background: #fef0f0;
  color: var(--danger-color);
}

.tag-warning {
  background: #fdf6ec;
  color: var(--warning-color);
}

.tag-info {
  background: #f4f4f5;
  color: var(--info-color);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 20px;
}

.pagination a,
.pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-color);
}

.pagination a:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.pagination .active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.05);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  margin-right: 15px;
}

.stat-info h3 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 5px;
}

.stat-info p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 4px;
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  overflow: auto;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Tabs */
.tabs {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.tab-item {
  display: inline-block;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-secondary);
  transition: all 0.3s;
}

.tab-item:hover {
  color: var(--primary-color);
}

.tab-item.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #dcdfe6;
  transition: 0.3s;
  border-radius: 20px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.switch input:checked + .switch-slider {
  background-color: var(--primary-color);
}

.switch input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.alert-success {
  background: #f0f9eb;
  color: var(--success-color);
  border: 1px solid #c2e7b0;
}

.alert-danger {
  background: #fef0f0;
  color: var(--danger-color);
  border: 1px solid #fbc4c4;
}

.alert-warning {
  background: #fdf6ec;
  color: var(--warning-color);
  border: 1px solid #f5dab1;
}

/* 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;
  border-radius: 8px;
  width: 400px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo h1 {
  font-size: 28px;
  color: var(--text-color);
  margin-top: 10px;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form .form-control {
  padding: 12px 15px;
}

.login-form .btn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-muted { color: var(--text-secondary); }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.ml-10 { margin-left: 10px; }
.mr-10 { margin-right: 10px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-10 { gap: 10px; }

/* Responsive */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .admin-sidebar {
    transform: translateX(-100%);
  }
  
  .admin-main {
    margin-left: 0;
  }
}
