/* Parental Supervision Dashboard Specific Layout and Component Styles */

.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  background-color: var(--bg-primary);
  overflow: hidden;
}

/* SIDEBAR STYLING */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-tertiary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
}

.sidebar-brand {
  height: var(--header-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  font-size: 1.8rem;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-status {
  font-size: 0.75rem;
  display: block;
}

.devices-section {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  padding-left: 0.5rem;
}

.device-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 180px;
  overflow-y: auto;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  border: 1px solid transparent;
}

.device-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.device-item.active {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.2);
}

.device-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.device-dot.active {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.device-dot.offline {
  background-color: var(--text-muted);
}

.device-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-grow: 1;
}

.device-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.sidebar-menu {
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-grow: 1;
  overflow-y: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-family-body);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.menu-item.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.sidebar-user {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-family-title);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-grow: 1;
}

.user-details h4 {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-details span {
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
  transition: color 0.2s ease;
}

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

/* MAIN CONTENT LAYOUT */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.main-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: rgba(18, 18, 28, 0.4);
  backdrop-filter: blur(10px);
}

.header-device-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-device-info h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.device-metrics-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.metric-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.content-body {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
}

.panel {
  width: 100%;
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.info {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-color);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.stat-icon.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.stat-icon.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.stat-icon.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-content span:first-child {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-content h3 {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0.15rem 0;
}

.stat-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* DATA TABLE STYLING */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.data-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.data-table tbody tr {
  transition: background 0.2s ease;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.text-center { text-align: center; }
.text-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* DASHBOARD GRIDS */
.dashboard-split-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.card-header {
  margin-bottom: 1.25rem;
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-header span, .card-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-categories-progress {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.progress-category {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
}

.progress-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 50px;
}

.quick-actions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* MAP SCREEN LAYOUT */
.map-layout-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  height: calc(100vh - var(--header-height) - 4rem);
}

.map-view-box {
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.map-canvas {
  width: 100%;
  height: 100%;
  z-index: 10;
}

.map-controls-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.geofences-list-container {
  flex-grow: 1;
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.active-geofence-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.geofence-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 0.65rem 0.85rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
}

.geofence-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 75%;
}

.geofence-name-text {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.geofence-sub-text {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* FLAGGED MEDIA */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.media-card {
  position: relative;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  aspect-ratio: 1;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.media-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.media-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(9, 9, 14, 0.95) 0%, rgba(9, 9, 14, 0.4) 60%, transparent 100%);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.media-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
}

.media-sub {
  font-size: 0.65rem;
  color: #fda4af;
}

/* SETTINGS & SWITCHES */
.settings-toggle-group {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  border-radius: var(--border-radius-sm);
}

/* Custom Switch Toggle */
.switch-container {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch-container input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
  border: 1px solid var(--border-color);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

input:checked + .switch-slider {
  background: var(--accent-gradient);
}

input:checked + .switch-slider:before {
  transform: translateX(22px);
}

/* GDPR Box */
.gdpr-box {
  background: rgba(99, 102, 241, 0.04);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  margin-top: 2rem;
}

.gdpr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.gdpr-box p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.gdpr-actions {
  display: flex;
  gap: 1rem;
}

/* TOAST FLOATER */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 10000;
}

.toast {
  background: rgba(18, 18, 28, 0.9);
  border: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

@keyframes slideIn {
  from { transform: translateX(120%); }
  to { transform: translateX(0); }
}

.loading-placeholder {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 1rem;
  text-align: center;
}

/* WhatsApp Layout Styles */
.whatsapp-layout-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  height: calc(100vh - var(--header-height) - 4rem);
}

.whatsapp-chats-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.whatsapp-chats-list {
  list-style: none;
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.whatsapp-chat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.whatsapp-chat-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.whatsapp-chat-item.active {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.2);
}

.whatsapp-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.whatsapp-chat-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-grow: 1;
}

.whatsapp-chat-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.whatsapp-chat-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.whatsapp-chat-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.whatsapp-chat-preview {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.15rem;
}

.whatsapp-chat-window {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.whatsapp-chat-header {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.whatsapp-messages-body {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.whatsapp-message-bubble {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  font-size: 0.85rem;
  line-height: 1.4;
  position: relative;
  display: flex;
  flex-direction: column;
}

.whatsapp-message-bubble.incoming {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-top-left-radius: 2px;
}

.whatsapp-message-bubble.outgoing {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: white;
  border-top-right-radius: 2px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.whatsapp-message-time {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  align-self: flex-end;
  margin-top: 0.25rem;
}

.chat-placeholder-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  color: var(--text-muted);
  text-align: center;
}

.chat-placeholder-icon {
  font-size: 3rem;
  opacity: 0.5;
}

/* Call Recordings Styles */
.recordings-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.recording-card {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.2s ease;
}

.recording-card:hover {
  border-color: rgba(99, 102, 241, 0.25);
  background: rgba(255, 255, 255, 0.02);
}

.recording-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recording-card-title {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.recording-contact-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.recording-phone-number {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.recording-card-duration {
  font-size: 0.8rem;
  color: var(--info);
  font-weight: bold;
}

.recording-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recording-card-timestamp {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.recording-playback-widget {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius-sm);
  margin-top: 0.25rem;
}

.play-pause-btn {
  background: var(--accent-gradient);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.play-pause-btn:hover {
  transform: scale(1.05);
}

.recording-waveform-sim {
  flex-grow: 1;
  height: 20px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.waveform-bar {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  transition: height 0.15s ease, background 0.15s ease;
}

.recording-playback-widget.playing .waveform-bar {
  background: var(--accent-color);
}

