/* ==============================================================================
   🎨 MAIS INTERNET — PORTAL "MAIS CÂMERAS" PWA
   Identidade Visual: Clean White & Laranja Conexão (#FF5A00) com Azul Marinho (#001B44)
   ============================================================================== */

:root {
  --primary: #FF5A00;
  --primary-hover: #E04E00;
  --primary-glow: rgba(255, 90, 0, 0.25);
  --navy: #001B44;
  --navy-dark: #00122E;
  --cyan: #00E5FF;
  --bg-page: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  --danger: #EF4444;
  --success: #10B981;
  --radius: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   HEADER & NAVBAR
   ========================================================================== */
.header {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.brand-badge {
  background: #FFF7ED;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 90, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  text-align: right;
  font-size: 13px;
}

.user-name {
  font-weight: 700;
  color: var(--navy);
}

.user-contract {
  color: var(--text-muted);
  font-size: 12px;
}

.btn-logout {
  background: #F1F5F9;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: #E2E8F0;
  color: var(--danger);
}

/* ==========================================================================
   TELA DE LOGIN
   ========================================================================== */
.login-section {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 30px 20px;
  background: radial-gradient(circle at 50% 10%, rgba(255, 90, 0, 0.06) 0%, transparent 60%);
}

.login-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 420px;
  padding: 36px 28px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #FF8A00 0%, #FF5A00 100%);
}

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

.login-logo {
  height: 46px;
  margin-bottom: 12px;
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  font-size: 15px;
  background-color: #F8FAFC;
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  background-color: #FFFFFF;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #FF6F1A 0%, #FF5A00 100%);
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-weight: 700;
  font-size: 15px;
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(255, 90, 0, 0.3);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #E65100 0%, #D84315 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 90, 0, 0.4);
}

.login-hint {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   DASHBOARD / ÁREA DO CLIENTE
   ========================================================================== */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  width: 100%;
}

.status-banner {
  background: linear-gradient(135deg, #001B44 0%, #002C6E 100%);
  border-radius: var(--radius);
  padding: 20px 24px;
  color: #FFFFFF;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(0, 27, 68, 0.12);
}

.banner-left h2 {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-left p {
  font-size: 13px;
  color: #94A3B8;
  margin-top: 4px;
}

.connection-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: #34D399;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #34D399;
  border-radius: 50%;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ==========================================================================
   GRADE DE CÂMERAS AO VIVO
   ========================================================================== */
.section-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.cameras-grid.single-camera {
  grid-template-columns: 1fr;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}

.camera-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.camera-card:hover {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  border-color: #CBD5E1;
}

.video-container {
  position: relative;
  background-color: #000000;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.live-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(239, 68, 68, 0.9);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: #FFFFFF;
  border-radius: 50%;
  animation: live-blink 1s infinite alternate;
}

@keyframes live-blink {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

.camera-info {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cam-name-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cam-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-edit-cam-name {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-edit-cam-name:hover {
  background: #FFF7ED;
  border-color: #FFD8A8;
  color: var(--primary);
  transform: scale(1.1);
}

.cam-details {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cam-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: #F1F5F9;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: #475467;
}

.btn-icon:hover {
  background: #E2E8F0;
  color: var(--primary);
}

/* ==========================================================================
   LINHA DO TEMPO / HISTÓRICO 3 DIAS NA NUVEM
   ========================================================================== */
.history-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  padding: 24px;
}

.history-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  background: #F8FAFC;
  border: 1.5px solid var(--border-color);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn.active {
  background: #FFF7ED;
  border-color: var(--primary);
  color: var(--primary);
}

.recordings-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.recording-item {
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.recording-item:hover {
  border-color: #CBD5E1;
  background: #FFFFFF;
}

.rec-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.rec-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.rec-btn-play {
  background: #FFF7ED;
  border: 1px solid rgba(255, 90, 0, 0.2);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.rec-btn-play:hover {
  background: var(--primary);
  color: #FFFFFF;
}

/* ==========================================================================
   RESPONSIVIDADE MOBILE
   ========================================================================== */
@media (max-width: 640px) {
  .cameras-grid {
    grid-template-columns: 1fr;
  }
  
  .header-container {
    padding: 10px 16px;
  }
  
  .main-container {
    padding: 16px 14px 40px;
  }
  
  .status-banner {
    padding: 16px;
  }
}
