@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0d0f14;
  --surface: #161a22;
  --surface-hover: #1c212c;
  --border: #2a3142;
  --text: #e6e9f0;
  --text-muted: #8b92a8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --error: #f87171;
  --success: #34d399;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* Auth pages */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-glow), transparent),
              linear-gradient(180deg, var(--bg) 0%, #0a0c10 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-card h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.auth-card .sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-card label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input[type="email"] {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-card input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.auth-card .btn {
  width: 100%;
  padding: 0.875rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.05s;
  margin-top: 0.25rem;
}

.auth-card .btn:hover {
  background: var(--accent-hover);
}

.auth-card .btn:active {
  transform: scale(0.99);
}

.auth-card .link-row {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-card .link-row a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-card .link-row a:hover {
  text-decoration: underline;
}

.auth-card .alert {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.auth-card .alert-error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.auth-card .alert-success {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

/* Stream page: 整页不滚动，视频始终适配窗口 */
.stream-page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.stream-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.stream-header .title {
  font-size: 1.1rem;
  font-weight: 600;
}

.stream-header .user-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stream-header .source-select {
  padding: 0.4rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stream-header .username {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.stream-header .logout-form {
  margin: 0;
  padding: 0;
}

.stream-header .btn-logout {
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.stream-header .btn-logout:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.stream-container {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

.stream-container .video-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.stream-container .video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stream-placeholder {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

.stream-container .video-wrap .stream-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.stream-placeholder p {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.stream-no-source .stream-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Admin */
.admin-body {
  min-height: 100vh;
  background: var(--bg);
}

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

.admin-back {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.admin-back:hover {
  color: var(--accent);
}

.admin-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-header-right .logout-form.inline {
  margin: 0;
}

.admin-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.admin-flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.admin-section {
  margin-bottom: 2rem;
}

.admin-section h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

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

.admin-table th {
  background: var(--surface-hover);
  font-weight: 600;
  font-size: 0.875rem;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table .url-cell {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-form .form-row {
  margin-bottom: 1rem;
}

.admin-form .form-row label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.admin-form .form-row input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.admin-form .btn {
  margin-right: 0.5rem;
  margin-top: 0.25rem;
}

.admin-form .btn-secondary {
  background: var(--border);
  color: var(--text);
}

.link-btn {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid var(--border);
}

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

.link-btn.small {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

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

.link-edit, .link-delete {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0 0.25rem;
  margin-right: 0.5rem;
}

.link-edit {
  color: var(--accent);
  text-decoration: none;
}

.link-delete {
  color: var(--error);
}

.inline-form {
  display: inline;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  cursor: pointer;
}

.checkbox-label input {
  width: auto;
}

.url-small {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.badge {
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

.badge-ok {
  background: rgba(52, 211, 153, 0.2);
  color: var(--success);
}

.badge-pending {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}
