* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
}

.hidden { display: none !important; }

/* 登录页面 */
#login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 20px;
}

.login-logo img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.login-box h1 {
  text-align: center;
  margin-bottom: 8px;
  color: #2c3e50;
  font-size: 22px;
}

.login-subtitle {
  text-align: center;
  color: #7f8c8d;
  margin-bottom: 25px;
  font-size: 14px;
}

.login-box input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.login-box button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
}

.login-box button:hover { opacity: 0.9; }

.error { color: #e74c3c; text-align: center; margin-top: 10px; }

/* 主页面布局 */
#main-page {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: #2c3e50;
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  flex-shrink: 0;
}

.sidebar-logo img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
}

.sidebar-title {
  flex: 1;
  min-width: 0;
}

.sidebar-header h1 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.sidebar-header p {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-top: 5px;
}

.sidebar-nav {
  flex: 1;
  padding: 15px 0;
}

.nav-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 20px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.nav-btn.active {
  background: rgba(255,255,255,0.15);
  color: white;
  border-left: 3px solid #3498db;
}

.nav-btn svg {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  fill: currentColor;
}

.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info span {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
}

#logout-btn {
  padding: 6px 12px;
  background: rgba(231, 76, 60, 0.8);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

#logout-btn:hover { background: #e74c3c; }

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 30px;
  background: #f5f5f5;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 25px;
}

.page-header h2 {
  font-size: 24px;
  color: #2c3e50;
  font-weight: 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-card h3 {
  color: #7f8c8d;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.stat-card p {
  font-size: 32px;
  font-weight: 700;
  color: #2c3e50;
}

.stat-card.primary { border-left: 4px solid #3498db; }
.stat-card.success { border-left: 4px solid #27ae60; }
.stat-card.warning { border-left: 4px solid #f39c12; }
.stat-card.info { border-left: 4px solid #9b59b6; }
.stat-card.revenue { border-left: 4px solid #e74c3c; }
.stat-card.revenue p { color: #e74c3c; }
.stat-card.total-value { border-left: 4px solid #1abc9c; }
.stat-card.total-value p { color: #1abc9c; }

/* 工具栏 */
.toolbar {
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
}

.toolbar button {
  padding: 10px 20px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.toolbar button:hover { background: #219a52; }

/* 表格 */
.table-container {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 13px;
  color: #666;
  text-transform: uppercase;
}

tr:hover { background: #f8f9fa; }
tr:last-child td { border-bottom: none; }

.status-active { color: #27ae60; font-weight: 500; }
.status-revoked { color: #e74c3c; font-weight: 500; }
.status-expired { color: #f39c12; font-weight: 500; }

.action-btn {
  padding: 6px 12px;
  margin-right: 5px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.btn-view { background: #3498db; color: white; }
.btn-revoke { background: #e74c3c; color: white; }
.btn-deactivate { background: #f39c12; color: white; }
.btn-copy { 
  background: #95a5a6; 
  color: white; 
  padding: 4px 8px; 
  font-size: 11px;
  vertical-align: middle;
}
.btn-copy:hover { background: #7f8c8d; }

/* 分页 */
.pagination {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.pagination button {
  padding: 8px 14px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
}

.pagination button.active {
  background: #3498db;
  color: white;
  border-color: #3498db;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 模态框 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-content h2 {
  margin-bottom: 20px;
  color: #2c3e50;
}

.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.close:hover { color: #333; }

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #555;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: #3498db;
}

.form-actions {
  margin-top: 25px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.form-actions button {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.btn-primary { background: #3498db; color: white; }
.btn-primary:hover { background: #2980b9; }
.btn-secondary { background: #95a5a6; color: white; }
.btn-secondary:hover { background: #7f8c8d; }

code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
}


/* Toast 通知组件 */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
  cursor: pointer;
}

.toast.success { background: #27ae60; }
.toast.error { background: #e74c3c; }
.toast.warning { background: #f39c12; }
.toast.info { background: #3498db; }

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  word-break: break-word;
  white-space: pre-wrap;
}

.toast-close {
  font-size: 18px;
  opacity: 0.8;
  cursor: pointer;
  margin-left: 10px;
}

.toast-close:hover { opacity: 1; }

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast.hiding {
  animation: slideOut 0.3s ease forwards;
}

/* 确认对话框 */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.confirm-box {
  background: white;
  padding: 25px 30px;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.confirm-box h3 {
  margin-bottom: 15px;
  color: #2c3e50;
}

.confirm-box p {
  color: #666;
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.confirm-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.confirm-cancel {
  background: #95a5a6;
  color: white;
}

.confirm-ok {
  background: #3498db;
  color: white;
}

.confirm-danger {
  background: #e74c3c;
  color: white;
}
