/* Main Dashboard Styles */
:root {
  --primary: #00a5d0;
  --primary-color: #00a5d0;
  --app-footer-bg: #f5f5f5;
  --app-header-bg: #001f3d;
  --app-footer-color: #ccc;
  --secondary-main: #001529;
  --app-header-color: #ccc;
  --black: #000;
  --black-85: rgba(0, 0, 0, 0.85);
  --black-65: rgba(0, 0, 0, 0.65);
  --black-45: rgba(0, 0, 0, 0.45);
  --secondary-main: #001529;
  --gray-05: #fafafa;
  --gray-10: #f0f0f0;
  --gray-20: #e8e8e8;
  --gray-30: #f5f5f5;
  --gray-40: #d9d9d9;
  --gray-60: #bfbfbf;
  --gray-70: #898c8f;
  --gray-90: #262626;
  --footer-height: 42px;
  --utility-bar-height: 40px;
  --max-header-height: 104px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(
    135deg,
    var(--secondary-main) 0%,
    var(--app-header-bg) 50%,
    var(--primary) 100%
  );
  min-height: 100vh;
  color: #333;
}

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

.header {
  text-align: center;
  margin-bottom: 30px;
  color: white;
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.cameras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.camera-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.camera-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.camera-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.camera-name {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
}

.camera-status {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
}

.camera-status.online {
  background: #d4edda;
  color: #155724;
}

.camera-status.offline {
  background: #f8d7da;
  color: #721c24;
}

.camera-status.unknown {
  background: #fff3cd;
  color: #856404;
}

.video-container {
  position: relative;
  width: 100%;
  height: 200px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 15px;
}

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

.video-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, var(--gray-20), var(--gray-10));
  color: var(--gray-70);
  font-size: 1.1rem;
}

.camera-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.action-btn {
  flex: 1;
  padding: 10px 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}

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

.action-btn.primary:hover {
  background: var(--secondary-main);
  transform: translateY(-2px);
}

.action-btn.secondary {
  background: var(--gray-10);
  color: var(--gray-90);
}

.action-btn.secondary:hover {
  background: var(--gray-20);
  transform: translateY(-2px);
}

.latest-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.latest-image,
.latest-gif {
  text-align: center;
}

.latest-image h4,
.latest-gif h4 {
  font-size: 0.9rem;
  color: var(--gray-70);
  margin-bottom: 8px;
}

.latest-image img,
.latest-gif img {
  width: 100%;
  /* max-height: 200px; */
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--gray-20);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.latest-image img:hover,
.latest-gif img:hover {
  transform: scale(1.05);
}

.footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px;
  border-radius: 15px;
  color: var(--app-footer-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.footer-logo {
  height: 30px;
  width: auto;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray-70);
  font-size: 1.2rem;
}

/* Modal for full-size image viewing */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
}

.modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 90%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-content img {
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
}

.close:hover {
  color: #bbb;
}

/* Camera page styles */
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover {
  text-decoration: underline;
}

.camera-info {
  background: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.carousel-container {
  background: white;
  padding: 25px;
  border-radius: 15px;
  margin-bottom: 20px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.carousel-title {
  font-size: 1.3rem;
  font-weight: bold;
  margin-bottom: 15px;
  color: var(--primary);
}

.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  margin-bottom: 15px;
}

.carousel-inner {
  display: flex;
  transition: transform 0.5s ease;
}

.carousel-item {
  min-width: 100%;
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  opacity: 0;
}

.carousel-item img:hover {
  transform: scale(1.02);
}

/* Image placeholders for lazy loading in main gallery */
.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  transition: opacity 0.3s ease;
}

.image-placeholder .loading {
  text-align: center;
}

.image-placeholder .error {
  color: #ff6b6b;
  text-align: center;
}

.carousel-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.carousel-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
}

.carousel-btn:hover {
  background: var(--secondary-main);
}

.carousel-btn:disabled {
  background: #bfbfbf;
  cursor: not-allowed;
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d9d9d9;
  cursor: pointer;
}

.indicator.active {
  background: var(--primary);
}

/* Dashboard improvements based on original app.py */
.cameras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.camera-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.camera-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.camera-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--gray-20);
}

.camera-name {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--primary);
}

.camera-status {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}

.camera-status.online {
  background: #d4edda;
  color: #155724;
}

.camera-status.offline {
  background: #f8d7da;
  color: #721c24;
}

.video-container {
  position: relative;
  margin-bottom: 20px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.video-container video {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
}

.video-placeholder {
  width: 100%;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
}

.camera-actions {
  display: flex;
  margin-bottom: 20px;
}

.action-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

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

.action-btn.primary:hover {
  background: var(--secondary-main);
  transform: translateY(-2px);
}

.action-btn.secondary {
  background: var(--gray-20);
  color: var(--gray-90);
}

.action-btn.secondary:hover {
  background: var(--gray-40);
  transform: translateY(-2px);
}

.latest-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.latest-media h4 {
  margin-bottom: 10px;
  color: var(--gray-90);
  font-size: 1rem;
}

.latest-media img {
  width: 100%;
  /* height: 120px; */
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.latest-media img:hover {
  transform: scale(1.05);
}

.stream-info {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 15px;
  border-radius: 10px;
  margin: 15px 0;
  text-align: center;
  font-weight: 500;
}

.stream-info.low-power {
  background: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

/* Responsive Design */
@media (max-width: 768px) {
  .cameras-grid {
    grid-template-columns: 1fr;
  }

  .header h1 {
    font-size: 2rem;
  }

  .camera-card {
    padding: 20px;
  }

  .footer {
    flex-direction: column;
    gap: 5px;
  }

  .modal-content {
    max-width: 95%;
    max-height: 95%;
  }

  .close {
    top: 10px;
    right: 20px;
    font-size: 30px;
  }

  .carousel-item img {
    height: 250px;
  }
}

/* Low power mode styles */
.low-power-warning {
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  border-radius: 15px;
  padding: 25px;
  margin: 20px 0;
  box-shadow: 0 10px 30px rgba(255, 107, 53, 0.3);
  text-align: center;
  color: white;
}

.warning-content h3 {
  margin-bottom: 15px;
  font-size: 1.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.warning-content p {
  margin: 10px 0;
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Hide video player in low power mode */
.low-power-mode .video-container {
  display: none;
}

.low-power-mode .stream-info {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 15px;
  border-radius: 10px;
  margin: 10px 0;
  text-align: center;
}
