/* 页面布局基础 */
html {
  height: 100%;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #ca8a04;
  --background: #f8fafc;
  --text: #1e293b;
  --border: #e2e8f0;
  --text-light: #64748b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header */
.header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
  display: flex;
  align-items: baseline;
}

.version {
  font-size: 0.75rem;
  font-weight: normal;
  color: var(--text-light);
  margin-left: 0.5rem;
  opacity: 0.7;
}

/* Navigation */
.nav {
  display: flex;
  gap: 1rem;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
}

.nav-link:hover {
  background: var(--background);
}

.nav-link.active {
  color: var(--primary);
  font-weight: 500;
}

/* Main Content */
.main {
  padding: 2rem 0;
  flex: 1;
}

/* Cards */
.card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
}

.card-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.card-content {
  padding: 1rem;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  opacity: 0.9;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  opacity: 0.9;
}

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

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

.table th {
  font-weight: 600;
  background: var(--background);
}

.table td.actions {
  display: flex;
  gap: 0.5rem;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
}

.badge-online {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
}

.badge-offline {
  background: rgba(100, 116, 139, 0.1);
  color: var(--secondary);
}

.badge-error {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.badge-recording {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
  position: relative;
}

.clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.clickable:hover {
  transform: scale(1.05);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

/* Add a small icon to indicate clickable */
.badge-recording.clickable::after {
  content: "▶";
  font-size: 9px;
  margin-left: 5px;
  vertical-align: middle;
}

/* Player elements */
#player-container {
  position: relative;
  background-color: #000;
  border-radius: 4px;
  overflow: hidden;
}

#webrtc-player {
  display: block;
  background-color: #000;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.justify-center {
  justify-content: center;
}

.text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-container {
  position: relative;
  background: white;
  border-radius: 0.5rem;
  width: 100%;
  max-width: 500px;
  z-index: 51;
}

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

.modal-content {
  padding: 1rem;
}

.modal-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.alert-success {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
}

/* Grid */
.grid {
  display: grid;
  gap: 1rem;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* Utilities */
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.text-center { text-align: center; }
.hidden { display: none; }

/* Form Select */
.form-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
    background-color: white;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.form-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.form-help {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Videos Grid */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.video-card {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.video-card:hover {
    transform: translateY(-2px);
}

.video-thumbnail {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #f1f5f9;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.video-info {
    padding: 0.75rem;
}

.video-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.video-date {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Video Modal */
.video-modal {
    max-width: 900px !important;
}

.video-player {
    aspect-ratio: 16 / 9;
    background: black;
    margin: -1rem -1rem 1rem -1rem;
}

.video-player-element {
    width: 100%;
    height: 100%;
}

/* Pagination */
.pagination {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.pagination-info {
    color: var(--text-light);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 添加代码块和流信息显示的样式 */
.code-block {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 8px;
  font-family: monospace;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 8px 0;
  max-width: 100%;
}

.stream-details {
  background: #f8f8f8;
  border-left: 3px solid #4c9aff;
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: 0 3px 3px 0;
}

details {
  margin: 8px 0;
}

details summary {
  cursor: pointer;
  color: #2563eb;
  font-weight: 500;
}

details summary:hover {
  text-decoration: underline;
}

/* 页脚样式 */
.footer {
  margin-top: auto;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-light);
  font-size: 0.875rem;
  background-color: white;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}