* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

/* Шапка */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: #ffffff;
  padding: 16px 24px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  border: 1px solid #e2e8f0;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  background: #2b6cb0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  box-shadow: 0 6px 12px rgba(43, 108, 176, 0.25);
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #1e293b;
  white-space: nowrap;
}

.logo-text span {
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748b;
  display: block;
  margin-top: -2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.storage-usage {
  background: #f8fafc;
  padding: 8px 16px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e2e8f0;
}

.storage-usage i {
  color: #3b82f6;
  font-size: 1.2rem;
}

.storage-usage .progress {
  width: 120px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.storage-usage .progress-fill {
  width: 68%;
  height: 100%;
  background: #3b82f6;
  border-radius: 4px;
}

.storage-usage span {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.avatar-btn {
  background: #edf2f7;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #2d3748;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.avatar-btn:hover {
  background: #e2e8f0;
}

/* Сетка камер */
.cameras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.camera-card {
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.camera-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.08);
}

.camera-preview {
  position: relative;
  background: #0f172a;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  overflow: hidden;
}

.camera-preview i {
  font-size: 3rem;
  opacity: 0.5;
}

.preview-placeholder {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-badge {
  background: #ef4444;
  color: white;
  padding: 2px 8px;
  border-radius: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.camera-info {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.camera-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.camera-title h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
}

.status-online {
  color: #10b981;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.camera-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #64748b;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-item i {
  width: 16px;
  color: #94a3b8;
}

/* Облачное хранилище */
.storage-section {
  background: #ffffff;
  border-radius: 24px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
}

.storage-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.stat-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: #eef2ff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4f46e5;
  font-size: 1.5rem;
}

.stat-details h4 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #64748b;
}

.stat-details .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
}

.upload-btn {
  background: #2b6cb0;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 8px 16px rgba(43, 108, 176, 0.25);
  white-space: nowrap;
}

.upload-btn:hover {
  background: #1e4e8c;
  transform: scale(1.02);
}

/* Таблица событий */
.events-section {
  background: #ffffff;
  border-radius: 24px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.02);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
}

.filter-tabs {
  display: flex;
  gap: 8px;
}

.filter-tab {
  padding: 6px 16px;
  border-radius: 30px;
  background: #f1f5f9;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: default;
  border: none;
  color: #334155;
}

.filter-tab.active {
  background: #2b6cb0;
  color: white;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
}

.events-table th {
  text-align: left;
  padding: 12px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e2e8f0;
}

.events-table td {
  padding: 14px 8px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
  color: #334155;
}

.event-type {
  display: flex;
  align-items: center;
  gap: 8px;
}

.event-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.badge-motion {
  background: #f59e0b;
}
.badge-recording {
  background: #3b82f6;
}
.badge-alert {
  background: #ef4444;
}
.badge-system {
  background: #8b5cf6;
}

.btn-download {
  background: transparent;
  border: 1px solid #cbd5e1;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  color: #2b6cb0;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-download:hover {
  background: #eef2ff;
  border-color: #2b6cb0;
}

/* Подвал */
.footer {
  text-align: center;
  font-size: 0.8rem;
  color: #94a3b8;
  padding: 16px 0 8px;
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  padding: 18px 20px 20px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(8px);
  color: #e2e8f0;
  box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease;
}

.cookie-banner.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cookie-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.cookie-text {
  flex: 1;
}

.cookie-text h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
  color: #f8fafc;
}

.cookie-text p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.cookie-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: #2b6cb0;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 22px;
  transition: background 0.2s ease;
}

.cookie-btn:hover {
  background: #1e4e8c;
}

/* Модальное окно авторизации */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.auth-modal {
  background: #ffffff;
  border-radius: 28px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  transition: transform 0.25s ease;
  position: relative;
}

.modal-overlay.active .auth-modal {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: #f1f5f9;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  font-size: 1.2rem;
  transition: background 0.2s;
}

.modal-close:hover {
  background: #e2e8f0;
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header .auth-icon {
  background: #2b6cb0;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.8rem;
  margin: 0 auto 16px;
  box-shadow: 0 10px 20px rgba(43, 108, 176, 0.3);
}

.auth-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.auth-header p {
  color: #64748b;
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 0.95rem;
  transition:
    border 0.2s,
    box-shadow 0.2s;
  background: #f8fafc;
  outline: none;
}

.form-group input:focus {
  border-color: #2b6cb0;
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
  background: #ffffff;
}

.auth-submit {
  width: 100%;
  background: #2b6cb0;
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
  letter-spacing: 0.3px;
}

.auth-submit:hover {
  background: #1e4e8c;
}

.auth-alt {
  text-align: center;
  margin-top: 18px;
  font-size: 0.85rem;
  color: #64748b;
}

.auth-alt a {
  color: #2b6cb0;
  font-weight: 600;
  text-decoration: none;
}

.auth-alt a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .app-container {
    padding: 12px;
  }
  .storage-section {
    flex-direction: column;
    align-items: flex-start;
  }
  .cameras-grid {
    grid-template-columns: 1fr;
  }
  .auth-modal {
    margin: 16px;
    padding: 24px;
  }
  .cookie-content {
    flex-direction: column;
    align-items: stretch;
  }
  .cookie-btn {
    width: 100%;
  }
}
