/* Layout CSS - Modern Whodunnit System */

/* Base Layout */
html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-secondary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

/* Skip Link (Accessibility) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-dark);
  color: var(--text-light);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  z-index: var(--z-tooltip);
}

.skip-link:focus {
  top: 0;
}

/* App Container */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.header {
  background: var(--primary-bg);
  border-bottom: 4px solid var(--primary-dark);
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: var(--z-sticky);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  max-width: 1400px;
  margin: 0 auto;
}

.header-title {
  font-family: var(--font-primary);
  font-size: var(--text-3xl);
  font-weight: bold;
  color: var(--text-light);
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header-nav {
  display: flex;
  gap: var(--space-2);
}

.nav-button {
  background: transparent;
  color: var(--text-light);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  font-size: var(--text-sm);
  font-weight: 500;
}

.nav-button:hover,
.nav-button:focus {
  background: var(--primary-dark);
  transform: translateY(-1px);
  color: #4A4A4A !important;
}

.nav-button.active {
  background: var(--primary-dark);
  color: #4A4A4A !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-stats {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-light);
}

/* Detective Info Display */
.detective-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-secondary);
}

.detective-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin: 0;
}

.detective-rank-display {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.rank-title {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

.rank-stars {
  display: flex;
  align-items: center;
  gap: 1px;
}

.rank-stars .star {
  font-size: 12px;
  transition: all 0.2s ease;
}

.rank-stars .star.active {
  color: #FFD700;
  text-shadow: 0 0 4px rgba(255, 215, 0, 0.5);
}

.rank-stars .star.inactive {
  color: #666;
  opacity: 0.3;
}

/* Rank promotion animation */
.detective-info.promoted {
  animation: rankPromotion 1s ease-in-out;
}

@keyframes rankPromotion {
  0% { transform: scale(1); }
  25% { transform: scale(1.05); box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
  50% { transform: scale(1.1); box-shadow: 0 0 30px rgba(255, 215, 0, 0.7); }
  75% { transform: scale(1.05); box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
  100% { transform: scale(1); box-shadow: none; }
}

.stat-points {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--primary-dark);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

/* Screens */
.screen {
  display: none;
  padding: var(--space-6);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn var(--transition-slow);
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Home Screen */
.home-hero {
  text-align: center;
  padding: var(--space-12) 0;
}

.hero-title {
  font-family: var(--font-primary);
  font-size: var(--text-4xl);
  color: var(--primary-dark);
  margin-bottom: var(--space-2);
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
}

.hero-actions {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-12);
}

/* Game Screen Layout */
.game-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: var(--space-6);
  height: calc(100vh - 120px);
}

/* Case Panel */
.case-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  border: 2px solid var(--primary-light);
}

.case-title {
  font-family: var(--font-primary);
  font-size: var(--text-2xl);
  color: var(--primary-dark);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 2px solid var(--primary-light);
}

/* Case header with audio button */
.case-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--primary-light);
}

.case-header .case-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
  flex: 1;
}

.audio-player {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex-shrink: 0;
  margin-bottom: var(--space-4);
}

.waveform-section {
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-controls {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  padding-top: var(--space-2);
}



.waveform-container {
  flex: 1;
  min-width: 200px;
  height: 40px;
}

.audio-control-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--card-bg);
  color: var(--text-primary);
  border: 2px solid var(--primary-light);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--text-sm);
  font-weight: 500;
  min-width: 80px;
  justify-content: center;
}

.audio-control-btn:hover {
  background: var(--primary-light);
  border-color: var(--accent-gold);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.audio-control-btn:active {
  transform: translateY(0);
}

.audio-control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.audio-control-btn:disabled:hover {
  background: var(--card-bg);
  border-color: var(--primary-light);
  transform: none;
  box-shadow: none;
}

.audio-control-btn .control-icon {
  font-size: var(--text-base);
}

.audio-control-btn .control-label {
  font-size: var(--text-sm);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Responsive audio player */
@media (max-width: 768px) {
  .case-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }
  
  .audio-player {
    align-self: flex-start;
  }
  
  .waveform-container {
    min-width: 150px;
  }
  
  .audio-controls {
    gap: var(--space-3);
  }
  
  .audio-control-btn {
    min-width: 70px;
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
  }
  
  .audio-control-btn .control-icon {
    font-size: var(--text-sm);
  }
  
  .audio-control-btn .control-label {
    font-size: var(--text-xs);
  }
}

.case-narrative {
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
}

.case-evidence {
  background: var(--bg-body);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.case-evidence h3 {
  font-size: var(--text-lg);
  font-weight: bold;
  color: var(--primary-dark);
  margin-bottom: var(--space-2);
}

.evidence-list {
  list-style: none;
}

.evidence-list li {
  padding: var(--space-2) 0;
  padding-left: var(--space-4);
  position: relative;
}

.evidence-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-gold);
  font-weight: bold;
}

.case-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-weight: 500;
  color: var(--text-secondary);
}

/* Main Area */
.main-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  overflow-y: auto;
}

/* Search Section */
.search-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

.section-title {
  font-family: var(--font-primary);
  font-size: var(--text-xl);
  color: var(--primary-dark);
  margin-bottom: var(--space-4);
}

/* Results Section */
.results-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  flex: 1;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.results-count {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-tooltip);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}

.loading-screen.active {
  opacity: 1;
  visibility: visible;
}

.loading-content {
  text-align: center;
  color: var(--text-light);
}

.loading-title {
  font-family: var(--font-primary);
  font-size: var(--text-4xl);
  margin-bottom: var(--space-2);
}

.loading-subtitle {
  font-size: var(--text-lg);
  margin-bottom: var(--space-6);
}

.loading-progress {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0 auto;
}

.loading-bar {
  height: 100%;
  background: var(--accent-gold);
  width: 0%;
  animation: loading 2s ease-in-out infinite;
}

@keyframes loading {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .game-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .case-panel {
    max-height: 300px;
  }
  
  .header-content {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  
  .header-nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .header-content {
    padding: var(--space-3);
  }
  
  .header-title {
    font-size: var(--text-2xl);
  }
  
  .nav-button {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
  }
  
  .screen {
    padding: var(--space-3);
  }
  
  .hero-title {
    font-size: var(--text-3xl);
  }
  
  .hero-actions {
    flex-direction: column;
  }
  
  .home-features {
    grid-template-columns: 1fr;
  }
} 

/* Case Modal Styles */
.case-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
}

.case-modal-content {
  background-color: #1a1a1a;
  margin: 2% auto;
  padding: 0;
  border: 2px solid #8B4513;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  color: #d4af37;
  box-shadow: 0 0 20px rgba(139, 69, 19, 0.5);
}

.case-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: #2c1810;
  border-bottom: 1px solid #8B4513;
  border-radius: 8px 8px 0 0;
}

.sound-player-container {
  flex: 1;
}

.sound-player-container audio {
  width: 100%;
  max-width: 400px;
  height: 40px;
}

.case-modal-close {
  background: none;
  border: none;
  color: #d4af37;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  margin-left: 15px;
}

.case-modal-close:hover {
  color: #fff;
}

.case-modal-body {
  padding: 20px;
}

.dialogue-container {
  min-height: 200px;
  margin-bottom: 20px;
  background-color: #2c1810;
  border: 1px solid #8B4513;
  border-radius: 5px;
  padding: 20px;
}

.character-dialogue {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 15px;
}

.character-dialogue.sherlock {
  flex-direction: row;
}

.character-dialogue.watson,
.character-dialogue.other {
  flex-direction: row-reverse;
}

.character-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid #8B4513;
  flex-shrink: 0;
}

.character-speech {
  flex: 1;
  background-color: #1a1a1a;
  border: 1px solid #8B4513;
  border-radius: 10px;
  padding: 15px;
  position: relative;
  max-width: 70%;
}

.character-dialogue.sherlock .character-speech::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 20px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 10px solid #1a1a1a;
}

.character-dialogue.watson .character-speech::before,
.character-dialogue.other .character-speech::before {
  content: '';
  position: absolute;
  right: -10px;
  top: 20px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 10px solid #1a1a1a;
}

.character-name {
  font-weight: bold;
  color: #d4af37;
  margin-bottom: 5px;
  font-size: 14px;
}

.character-text {
  color: #e0e0e0;
  line-height: 1.4;
  font-size: 16px;
}

.dialogue-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-top: 1px solid #8B4513;
}

.dialogue-nav-btn {
  background-color: #8B4513;
  color: #d4af37;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.3s;
}

.dialogue-nav-btn:hover:not(:disabled) {
  background-color: #a0522d;
}

.dialogue-nav-btn:disabled {
  background-color: #555;
  color: #888;
  cursor: not-allowed;
}

.dialogue-counter {
  color: #d4af37;
  font-weight: bold;
  font-size: 14px;
}

/* Animation for dialogue transitions */
.dialogue-fade-in {
  animation: fadeInDialogue 0.5s ease-in-out;
}

@keyframes fadeInDialogue {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
} 