:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --primary: #0066ff;
  --primary-hover: #2563eb;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
  --font: 'Inter', -apple-system, sans-serif;
}

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

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

.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 40px;
}

.brand img {
  height: 42px;
}

.brand h2 {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-radius: 12px;
  transition: all 0.2s;
}

.nav-item.active a, .nav-item a:hover {
  background: var(--primary);
  color: #fff;
}

.main-content {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

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

header h1 {
  font-size: 26px;
  font-weight: 800;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 28px;
}

.upload-box {
  border: 2px dashed #475569;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
}

.upload-box:hover {
  border-color: var(--primary);
  background: rgba(0, 102, 255, 0.05);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
}

/* WORKSPACE LAYOUT & LOGIN STYLES */
.workspace-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

.login-card {
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.login-brand {
  text-align: center;
  margin-bottom: 30px;
}

.login-brand svg {
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.login-brand h1 {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}

.login-brand p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

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

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.btn-block {
  width: 100%;
  padding: 14px;
}

.login-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  margin-top: 16px;
  font-weight: 600;
}

/* USER PROFILE IN SIDEBAR */
.sidebar {
  justify-content: space-between; /* pushes user profile to bottom */
}

.nav-links {
  flex-grow: 1;
}

.user-profile {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
}

.user-email {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

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

.btn-logout {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

/* TV MOCKUP STYLES */
.tv-mockup-wrapper {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}
.tv-mockup-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 14px 0;
}
.tv-mockup-screen {
  width: 100%;
  max-width: 500px;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, rgba(235, 243, 255, 0.95) 0%, rgba(215, 230, 255, 0.9) 50%, rgba(180, 210, 255, 0.85) 100%);
  border: 6px solid #1e293b;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  position: relative;
  display: grid;
  grid-template-rows: 28px 1fr 14px;
  padding: 6px 12px 4px 12px;
  gap: 6px;
  overflow: hidden;
  color: #0f172a;
  box-sizing: border-box;
}
.mock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 34, 102, 0.1);
  padding-bottom: 4px;
}
.mock-logo {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mock-logo img {
  height: 16px;
  width: auto;
}
.mock-header-titles {
  display: flex;
  flex-direction: column;
}
.mock-header-titles h1 {
  font-size: 8px;
  font-weight: 900;
  color: #002266;
  margin: 0;
  line-height: 1;
}
.mock-header-titles p {
  font-size: 4px;
  font-weight: 800;
  color: #0044b3;
  margin: 0;
  letter-spacing: 0.5px;
}
.mock-weather-time {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: right;
  font-size: 6px;
  color: #0f172a;
}
.mock-main {
  display: grid;
  grid-template-columns: 60px 1fr 80px;
  gap: 8px;
  min-height: 0;
}
.mock-sidebar-left {
  background: linear-gradient(180deg, #002266 0%, #001540 100%);
  color: #fff;
  border-radius: 8px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  font-size: 5px;
}
.mock-sidebar-left .mock-icon {
  font-size: 10px;
}
.mock-center-display {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  border: 1px solid rgba(0, 68, 179, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.mock-sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mock-callout {
  background: linear-gradient(135deg, #0066ff, #0044b3);
  color: #fff;
  border-radius: 8px;
  padding: 4px;
  text-align: center;
  font-size: 5px;
  font-weight: bold;
}
.mock-all-barrios {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 6px;
  flex-grow: 1;
  font-size: 5px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.mock-footer {
  text-align: center;
  color: #475569;
  border-top: 1px solid rgba(0, 34, 102, 0.1);
  padding-top: 2px;
  font-size: 5px;
  font-style: italic;
}
.mock-dashboard-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.mock-slide-preview-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
  gap: 4px;
}
.mock-slide-preview-image {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: white;
  text-shadow: 1px 1px 3px black;
  font-size: 6px;
  padding: 4px;
  box-sizing: border-box;
}
.mock-slide-preview-video {
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  gap: 4px;
}

/* RESULTS LAYOUT */
.results-grid-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.scroll-table-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.scroll-table-container table {
  margin-top: 0;
}
.scroll-table-container th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 10;
}


