/* Modern Dark Theme CSS for IP Web Camera Cloud Portal & Viewer */

:root {
  --bg-primary: #0a0e17;
  --bg-card: #141c2b;
  --bg-card-hover: #1a2438;
  --bg-input: #1e293b;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(59, 130, 246, 0.5);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------
   Portal View (Login / Connection Card)
   ------------------------------------------------------------- */
.portal-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at top, #1e293b 0%, #0a0e17 100%);
}

.portal-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.portal-header {
  text-align: center;
  margin-bottom: 28px;
}

.portal-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.portal-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.portal-header .subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.portal-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrap input {
  width: 100%;
  height: 48px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 16px;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
}

.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.input-wrap input[uppercase] {
  text-transform: uppercase;
  font-family: monospace;
  letter-spacing: 0.08em;
}

.btn-connect {
  height: 50px;
  margin-top: 6px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.btn-connect:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
}

.portal-footer {
  margin-top: 24px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* -------------------------------------------------------------
   Surveillance Viewer View
   ------------------------------------------------------------- */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 30px;
  height: 30px;
  background-color: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.brand-title {
  font-weight: 700;
  font-size: 1rem;
}

.cloud-badge {
  font-size: 0.65rem;
  background-color: rgba(59, 130, 246, 0.2);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-input);
  color: var(--text-secondary);
}

.badge-cam-id {
  background-color: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-family: monospace;
}

.badge-live {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent);
}

.badge-live .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

/* Main Grid Layout */
.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  padding: 16px 20px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 992px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

/* Video Section */
.video-section {
  display: flex;
  flex-direction: column;
}

.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
}

.overlay-badge {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: monospace;
}

.motion-overlay {
  position: absolute;
  top: 12px;
  right: 50px;
}

.motion-badge {
  background: rgba(239, 68, 68, 0.85);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.motion-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
  animation: pulse 1s infinite;
}

.hidden {
  display: none !important;
}

.overlay-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: white;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Sidebar & Cards */
.controls-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

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

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

.btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  color: #60a5fa;
}

/* Zoom Slider */
.slider-group {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.slider-value {
  color: var(--primary);
  font-family: monospace;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

/* Telemetry Grid */
.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.telemetry-item {
  background: var(--bg-input);
  padding: 10px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
}

.telemetry-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.telemetry-value {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 2px;
}

.app-footer {
  text-align: center;
  padding: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
}
