/* ============================================
   云守望 - 样式表
   ============================================ */

:root {
  /* 主色调 - 田园风 */
  --primary: #7fad39;
  --primary-dark: #6a9630;
  --primary-light: #9ec354;

  /* 辅助色 */
  --accent: #f5972b;
  --accent-light: #ffb762;

  /* 中性色 */
  --bg: #fdfbf6;
  --bg-card: #ffffff;
  --border: #e8e2d5;
  --text: #4a403a;
  --text-light: #8a7f79;
  --text-lighter: #b8b0ab;

  /* 状态色 */
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --info: #1890ff;

  /* 功能色 */
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
}

/* ============================================
   基础重置
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
               'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  border: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

input, select {
  font-family: inherit;
}

/* ============================================
   首页样式
   ============================================ */

.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  background: linear-gradient(135deg, #fdfbf6 0%, #f5f0e8 100%);
}

.hero h1 {
  font-size: 4rem;
  margin-bottom: 1rem;
  color: var(--primary);
  font-weight: 700;
}

.hero .subtitle {
  font-size: 1.5rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.hero .tagline {
  font-size: 1.1rem;
  color: var(--text-lighter);
  margin-bottom: 2rem;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-card .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  margin-bottom: 0.5rem;
  color: var(--text);
}

.feature-card p {
  color: var(--text-light);
}

/* ============================================
   登录页样式
   ============================================ */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, #fdfbf6 0%, #f5f0e8 100%);
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-box h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.login-box .subtitle {
  color: var(--text-light);
  margin-bottom: 2rem;
}

.demo-hint {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #fff7e6;
  border: 1px solid #ffd591;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-light);
}

/* ============================================
   应用布局
   ============================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 2rem 1rem;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.sidebar-header .user-info {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 2rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar nav a {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: var(--transition);
  font-weight: 500;
}

.sidebar nav a:hover {
  background: var(--bg);
}

.sidebar nav a.active {
  background: var(--primary);
  color: white;
}

.sidebar-footer {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* 主内容区 */
.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 2rem;
}

.main-content header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.main-content header h1 {
  font-size: 2rem;
  color: var(--text);
}

.main-content header .date {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* ============================================
   组件样式
   ============================================ */

/* 按钮 */
.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: var(--transition);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-full {
  width: 100%;
}

.btn-danger {
  background: var(--danger);
  color: white;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #ff7875;
}

/* 表单 */
.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(127, 173, 57, 0.1);
}

/* 卡片 */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.content-card h3 {
  margin-bottom: 1.5rem;
  color: var(--text);
  font-size: 1.3rem;
}

/* ============================================
   控制台样式
   ============================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  font-size: 2.5rem;
  opacity: 0.8;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* 设备列表 */
.device-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.device-item .device-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.device-item .device-icon {
  font-size: 2rem;
}

.device-item .device-name {
  font-weight: 600;
  color: var(--text);
}

.device-item .device-status {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-online {
  background: #f6ffed;
  color: var(--success);
  border: 1px solid #b7eb8f;
}

.status-offline {
  background: #fff2f0;
  color: var(--danger);
  border: 1px solid #ffccc7;
}

/* 活动日志 */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.activity-icon {
  font-size: 1.5rem;
}

.activity-info p {
  color: var(--text);
  font-weight: 500;
}

.activity-time {
  color: var(--text-lighter);
  font-size: 0.85rem;
}

/* ============================================
   设备管理样式
   ============================================ */

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.device-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  transition: var(--transition);
}

.device-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.device-card .device-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.device-card h4 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.device-card p {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.device-card .device-actions {
  display: flex;
  gap: 0.5rem;
}

.device-actions button {
  flex: 1;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

/* ============================================
   监控页样式
   ============================================ */

.monitor-controls {
  display: flex;
  gap: 0.5rem;
}

.monitor-container {
  position: relative;
}

.device-selector {
  margin-bottom: 1rem;
}

.device-selector select {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.video-placeholder {
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-content {
  text-align: center;
  color: #666;
}

.placeholder-content .icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.placeholder-content .hint {
  color: #999;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.monitor-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-item .label {
  color: var(--text-light);
  font-size: 0.9rem;
}

.info-item .value {
  color: var(--text);
  font-weight: 600;
}

.info-item .value.status {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.85rem;
}

/* 云台控制 */
.ptz-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  max-width: 200px;
  margin: 0 auto;
}

.ptz-btn {
  aspect-ratio: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ptz-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ============================================
   分享页样式
   ============================================ */

.share-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.share-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.share-info {
  flex: 1;
}

.share-info h4 {
  margin-bottom: 0.3rem;
  color: var(--text);
}

.share-info p {
  color: var(--text-light);
  font-size: 0.9rem;
}

.share-actions {
  display: flex;
  gap: 0.5rem;
}

.info-box {
  padding: 1rem;
  background: #f0f5ff;
  border: 1px solid #adc6ff;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.info-box p {
  margin-bottom: 0.5rem;
}

.info-box p:last-child {
  margin-bottom: 0;
}

/* ============================================
   设置页样式
   ============================================ */

.settings-form {
  max-width: 500px;
}

.toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: 0.4s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.danger-zone {
  border-color: var(--danger);
}

.danger-zone h3 {
  color: var(--danger);
}

.warning {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ============================================
   模态框
   ============================================ */

.modal {
  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.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.modal-content h3 {
  margin-bottom: 1.5rem;
  color: var(--text);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.form-actions button {
  flex: 1;
}

/* ============================================
   通用样式
   ============================================ */

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

.empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
}

.empty .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ============================================
   响应式设计
   ============================================ */

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 1rem;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .features {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .device-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ============================================
   动画效果
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-card,
.device-card,
.feature-card,
.stat-card {
  animation: fadeIn 0.3s ease-out;
}
