/* -- your existing CSS here, as in your code -- */
body { 
  background: #f7f8fa; 
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

.model-profile-main {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 24px auto 0 auto;
  padding: 0 12px 24px 12px;
  box-sizing: border-box;
}

.model-profile-panel {
  width: 100%;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  box-sizing: border-box;
  overflow: hidden;
}
.model-header-flex {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
}

.model-pp-avatar {
  flex: 0 0 auto;
  display: flex; 
  flex-direction: column; 
  align-items: center;
}

.model-pp-avatar img {
  width: 100px; 
  height: 100px; 
  border-radius: 12px;
  background: #f1f3f8;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.model-pp-summary {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  width: 100%;
}

.model-pp-row {
  display: flex; 
  align-items: center; 
  gap: 8px 12px; 
  flex-wrap: wrap; 
  min-width: 0;
  width: 100%;
}

.model-pp-username {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--primary-color, #ffa927);
  letter-spacing: 0;
  margin-right: 12px;
  line-height: 1.2;
  word-break: break-word;
  flex: 1 1 auto;
  min-width: 0;
}
.model-badge, .model-gender-badge, .model-age-badge {
  border-radius: 8px; 
  padding: 6px 12px; 
  font-weight: 600; 
  font-size: 0.9em; 
  margin: 2px 4px 2px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
  vertical-align: middle;
  white-space: nowrap;
}

.model-age-badge { background: #ffd5dc; color: #e02c48;}
.model-gender-badge { background: var(--gender-color,#ded3ff); color: #fff;}
.model-badge.hd { background:#13addb !important;color:#fff;}
.model-badge.new { background:#a5e751 !important;color:#234002;}

.model-country-flag {
  width: 24px; 
  height: 16px; 
  border-radius: 4px; 
  border: 1px solid #e0e0e0;
  background: #f6f8fb; 
  vertical-align: middle;
  object-fit: cover;
  margin-left: 4px;
}

.model-pp-stats {
  display: flex; 
  align-items: center; 
  gap: 12px 16px; 
  font-size: 1em;
  margin: 12px 0 8px 0; 
  flex-wrap: wrap;
  width: 100%;
}
.stat-pill {
  display: flex; 
  align-items: center;
  background: #f8fafd;
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 500;
  color: #2b3552;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  font-size: 0.9em;
  gap: 6px;
  white-space: nowrap;
}

.stat-pill .icon {
  font-size: 1em;
  opacity: 0.8;
}

.cb-cam-iframe {
  width: 100% !important;
  min-width: 0 !important;
  border-radius: 12px;
  outline: none;
  border: none !important;
  background: #151d29;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  overflow: hidden;
  scrollbar-width: none !important;
  display: block;
  margin: 8px 0;
  transition: box-shadow 0.3s ease;
}

.cb-cam-iframe:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}

.cb-cam-iframe::-webkit-scrollbar {display:none;}

.model-fallback-msg {
  display: none; 
  color: #e44; 
  margin: 16px 0 8px 0; 
  text-align: center; 
  font-size: 1em;
  padding: 12px;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
}
.model-meta-wrap {
  width: 100%;
  background: #f7fafd;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  padding: 20px;
  margin: 0;
  display: flex; 
  flex-direction: row; 
  flex-wrap: wrap; 
  gap: 24px;
  box-sizing: border-box;
  overflow: visible;
  align-items: flex-start;
}

.model-meta-col {
  flex: 1 1 250px;
  min-width: 200px;
  box-sizing: border-box;
}

.model-meta-item {
  margin-bottom: 12px;
  font-size: 1em;
  color: #273146;
  font-weight: 400;
  line-height: 1.5;
}

.model-meta-item b {
  color: #4263a5;
  font-weight: 600;
  font-size: 1em;
  margin-right: 8px;
  letter-spacing: 0;
  white-space: nowrap;
  display: inline-block;
}
.room-topic-value {
  white-space: pre-line;
  word-break: break-word;
  display: inline;
}

.model-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.model-tag-chip {
  display: inline-block;
  background: #e7f1ff;
  color: #1866c2;
  font-size: 0.85em;
  border-radius: 8px;
  padding: 4px 8px;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.model-tag-chip:hover {
  background: #d4e9ff;
}
/* Tablet Styles */
@media (max-width: 768px) {
  .model-profile-main {
    margin-top: 16px;
    padding: 0 8px 20px 8px;
  }
  
  .model-profile-panel {
    padding: 20px 16px;
    border-radius: 12px;
    gap: 16px;
  }
  
  .model-header-flex {
    gap: 16px;
  }
  
  .model-pp-avatar img {
    width: 80px;
    height: 80px;
  }
  
  .model-pp-username {
    font-size: 1.6em;
  }
  
  .model-meta-wrap {
    padding: 16px;
    gap: 16px;
  }
  
  .model-meta-col {
    flex: 1 1 100%;
    min-width: 0;
  }
}

/* Mobile Styles */
@media (max-width: 600px) {
  .model-profile-main {
    margin-top: 8px;
    padding: 0 4px 16px 4px;
  }
  
  .model-profile-panel {
    padding: 16px 12px;
    gap: 12px;
  }
  
  .model-header-flex {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
  }
  
  .model-pp-avatar {
    align-items: center;
  }
  
  .model-pp-avatar img {
    width: 90px;
    height: 90px;
  }
  
  .model-pp-summary {
    align-items: center;
    text-align: center;
    width: 100%;
  }
  
  .model-pp-username {
    font-size: 1.4em;
    text-align: center;
    width: 100%;
    max-width: none;
  }
  
  .model-pp-row {
    justify-content: center;
  }
  
  .model-pp-stats {
    justify-content: center;
    gap: 8px;
  }
  
  .stat-pill {
    font-size: 0.85em;
    padding: 4px 8px;
  }
  
  .model-meta-wrap {
    flex-direction: column;
    padding: 12px;
    gap: 12px;
  }
  
  .model-meta-col {
    min-width: 0;
  }
  
  .cb-cam-iframe {
    height: 320px !important;
    border-radius: 8px;
  }
}

/* Small Mobile Styles */
@media (max-width: 400px) {
  .model-profile-panel {
    padding: 12px 8px;
  }
  
  .model-pp-username {
    font-size: 1.2em;
  }
  
  .model-pp-avatar img {
    width: 70px;
    height: 70px;
  }
  
  .model-meta-wrap {
    padding: 8px;
  }
  
  .cb-cam-iframe {
    height: 280px !important;
  }
  
  .model-badge, .model-gender-badge, .model-age-badge {
    font-size: 0.8em;
    padding: 4px 8px;
  }
}
.model-written-bio {
  font-style: italic;
  color: #594f6b;
  background: #f6f7fc;
  padding: 12px 16px;
  margin: 0 0 16px 0;
  border-radius: 10px;
  width: 100%;
  text-align: left;
  box-sizing: border-box;
  border-left: 4px solid #d4e9ff;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .model-written-bio {
    padding: 10px 12px;
    margin: 0 0 12px 0;
    text-align: left;
  }
}

/* Enhanced Analytics Styles */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border-left: 4px solid var(--primary-color);
}

.metric-trend {
  font-size: 0.85em;
  color: #666;
  margin-top: 4px;
  font-weight: 500;
}

.insights-section {
  background: #f8fafc;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.insights-title {
  margin: 0 0 16px 0;
  color: #333;
  font-size: 1.1em;
  font-weight: 600;
}

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

.insight-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  border-left: 3px solid #ddd;
}

.insight-card.insight-positive {
  border-left-color: #10b981;
}

.insight-card.insight-opportunity {
  border-left-color: #f59e0b;
}

.insight-card.insight-negative {
  border-left-color: #ef4444;
}

.insight-card.insight-info {
  border-left-color: #3b82f6;
}

.insight-icon {
  font-size: 1.2em;
  flex-shrink: 0;
}

.insight-content .insight-title {
  font-weight: 600;
  color: #333;
  font-size: 0.9em;
  margin-bottom: 2px;
}

.insight-content .insight-message {
  color: #666;
  font-size: 0.85em;
  line-height: 1.3;
}

.chart-container {
  position: relative;
  height: 200px;
  margin: 16px 0;
}

.chart-legend {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  color: #666;
}

.legend-color {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

.analytics-dashboard {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.dashboard-header {
  text-align: center;
  margin-bottom: 24px;
}

.dashboard-title {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 1.5em;
  font-weight: 700;
}

.dashboard-icon {
  margin-right: 8px;
  font-size: 1.2em;
}

.dashboard-subtitle {
  color: #666;
  margin: 0;
  font-size: 0.95em;
}

.analytics-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.analytics-panel {
  background: #f9fafb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.panel-title {
  margin: 0 0 16px 0;
  color: #374151;
  font-size: 1.1em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-icon {
  font-size: 1.1em;
}

@media (max-width: 768px) {
  .analytics-content {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .metrics-row {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
  }
  
  .insights-grid {
    grid-template-columns: 1fr;
  }
  
  .chart-container {
    height: 180px;
  }
}

/* Enhanced Legend Styles */
.legend-header {
  margin-bottom: 16px;
  text-align: center;
}

.legend-subtitle {
  color: #666;
  font-size: 0.9em;
  margin-top: 4px;
  line-height: 1.4;
}

/* Activity Pattern Summary */
.activity-pattern-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin: 20px 0;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.pattern-stat {
  text-align: center;
}

.pattern-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 4px;
}

.pattern-label {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
}

.pattern-message {
  grid-column: 1 / -1;
  text-align: center;
  color: #64748b;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

@media (max-width: 768px) {
  .activity-pattern-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 15px;
  }
  
  .pattern-value {
    font-size: 1.5rem;
  }
}

/* Global overflow protection and constraints */
* {
  box-sizing: border-box;
}

html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

main {
  overflow-x: hidden;
  max-width: 100vw;
  box-sizing: border-box;
}

/* Full-Width Modern Layout */
.model-page-container {
  width: 100%;
  margin: 0;
  padding: 0 clamp(15px, 2vw, 40px) 40px clamp(15px, 2vw, 40px);
  background: #f8fafc;
  min-height: calc(100vh - 80px);
  box-sizing: border-box;
  overflow-x: hidden;
}

.model-hero-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 40px 0;
  margin: 0 calc(-1 * 15px) 30px calc(-1 * 15px);
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  box-sizing: border-box;
  overflow-x: hidden;
}

.model-hero-content {
  width: 100%;
  margin: 0;
  padding: 0 clamp(15px, 2vw, 40px);
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr minmax(0, auto);
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
  box-sizing: border-box;
}

.model-hero-avatar {
  width: 120px;
  height: 120px;
  max-width: 120px;
  border-radius: 20px;
  border: 4px solid rgba(255,255,255,0.2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.model-hero-info {
  min-width: 0;
  overflow: hidden;
}

.model-hero-info h1 {
  font-size: 2.8rem;
  font-weight: 700;
  margin: 0 0 15px 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.model-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
  min-width: 0;
}

.hero-badge {
  background: rgba(255,255,255,0.2);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

.model-hero-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  min-width: 0;
  flex-shrink: 0;
}

/* Similar Models Click Fix */
.similar-model-row {
  transition: background-color 0.2s ease;
}

.similar-model-row:hover {
  background-color: rgba(59, 130, 246, 0.05);
  border-radius: 8px;
}

.similar-model-row a {
  cursor: pointer;
}

.similar-model-row a:hover .similar-username {
  color: #3b82f6 !important;
}

.hero-stat-large {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.hero-stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Main Content Grid */
.model-content-grid {
  width: 100%;
  margin: 0;
  padding: 0 clamp(15px, 2vw, 40px);
  display: block;
  box-sizing: border-box;
  overflow-x: hidden;
}


.model-main-content {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.model-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Model Info Row - responsive for details and similar models */
.model-info-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: clamp(15px, 2.5vw, 25px);
  margin-bottom: clamp(20px, 3vw, 30px);
}

/* Responsive Analytics Cards */
.analytics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(15px, 2.5vw, 25px);
  margin-bottom: clamp(20px, 3vw, 30px);
}

.compact-analytics-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  transition: transform 0.2s, box-shadow 0.2s;
}

.compact-analytics-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f1f5f9;
}

.card-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

/* Compact Metrics Grid */
.metrics-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.metric-mini {
  text-align: center;
  padding: 15px;
  background: #f8fafc;
  border-radius: 12px;
}

.metric-mini-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 5px;
}

.metric-mini-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

/* Stream Section */
.stream-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
}

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

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ef4444;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* Enhanced Heatmap with Proper Axes */
.heatmap-compact {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
}

.heatmap-container-with-labels {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Hour labels (x-axis) */
.heatmap-hour-labels {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 5px;
}

.hour-label-spacer {
  width: 35px;
  flex-shrink: 0;
}

.hour-label {
  flex: 2;
  text-align: center;
  font-weight: 500;
}

/* Main heatmap with day labels */
.heatmap-with-days {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.heatmap-day-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-label {
  width: 35px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  text-align: right;
  flex-shrink: 0;
}

.heatmap-hour-row {
  display: flex;
  gap: 2px;
  flex: 1;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255,255,255,0.1);
}

.heatmap-cell:hover {
  transform: scale(1.4);
  border: 1px solid #374151;
  z-index: 10;
  position: relative;
}

/* Enhanced Legend */
.heatmap-legend-enhanced {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.legend-left {
  flex: 1;
}

.legend-right {
  display: flex;
  align-items: center;
  gap: 3px;
}

.legend-square {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.1);
}

/* Iframe scaling for larger screens */
@media (min-width: 1400px) {
  .cb-cam-iframe {
    min-height: 500px !important;
  }
}

@media (min-width: 1600px) {
  .cb-cam-iframe {
    min-height: 600px !important;
  }
}

@media (min-width: 1920px) {
  .cb-cam-iframe {
    min-height: 700px !important;
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .model-hero-content {
    grid-template-columns: auto 1fr;
    gap: 20px;
    text-align: left;
  }
  
  .model-hero-stats {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-around;
    margin-top: 20px;
  }
}
}

@media (max-width: 767px) {
  .model-hero-section {
    padding: 30px 0;
  }
  
  .model-hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: clamp(15px, 3vw, 25px);
  }
  
  .model-hero-info h1 {
    font-size: clamp(1.8rem, 5vw, 2.2rem);
  }
  
  .model-content-grid {
    grid-template-columns: 1fr;
  }
  
  .metrics-mini-grid {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  }
}

/* Enhanced tooltips for metrics */
.metric-mini {
  cursor: help;
  transition: transform 0.2s ease;
}

.metric-mini:hover .metric-mini-label {
  color: var(--primary-color);
}

.metric-mini[title]:hover {
  transform: translateY(-2px);
}
