/* The Edge iPod WebApp - Pilot Version CSS */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
  --primary-color: #1e1e1e;
  --secondary-color: #00ff88;
  --accent-color: #00bfff;
  --text-color: #ffffff;
  --bg-gradient: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%);
  --card-bg: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
}

body {
  background: var(--bg-gradient);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 10px;
  color: var(--text-color);
  overflow-x: hidden;
}

/* Day theme */
body.day {
  --primary-color: #f5f5f5;
  --text-color: #333333;
  --bg-gradient: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  --card-bg: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
}

/* iPod Body */
#ipod-body {
  width: 100%;
  max-width: 350px;
  height: 90vh;
  max-height: 700px;
  background: var(--card-bg);
  border-radius: 25px;
  box-shadow: 
    20px 20px 60px rgba(0, 0, 0, 0.3),
    -20px -20px 60px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Header */
header {
  height: 60px;
  background: linear-gradient(145deg, #333333 0%, #1f1f1f 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  border-bottom: 1px solid #444;
}

body.day header {
  background: linear-gradient(145deg, #e8e8e8 0%, #d0d0d0 100%);
  border-bottom: 1px solid #ccc;
}

#logo {
  font-size: 28px;
  font-weight: 300;
  color: var(--text-color);
  letter-spacing: 3px;
}

#theme-toggle {
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.2s ease;
  user-select: none;
}

#theme-toggle:hover {
  transform: scale(1.2);
}

/* Screen */
#screen {
  flex: 1;
  background: var(--card-bg);
  margin: 12px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Alert Panel */
#alert-panel {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  background: rgba(0, 255, 136, 0.15);
  border: 1px solid var(--secondary-color);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--secondary-color);
  z-index: 100;
  display: none;
  animation: slideDown 0.4s ease;
}

#alert-panel.show {
  display: block;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Panel Headers */
#chat-header, #log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 25px;
  background: linear-gradient(90deg, var(--secondary-color) 0%, var(--accent-color) 100%);
  color: #000;
  font-weight: 600;
}

#chat-close, #log-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #000;
  cursor: pointer;
  font-weight: bold;
}

/* Chat Panel */
#chat-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 20, 20, 0.98);
  backdrop-filter: blur(15px);
  display: flex;
  flex-direction: column;
  z-index: 200;
}

#chat-messages {
  flex: 1;
  padding: 25px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 20px;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.4;
}

.message.user {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #00dd77 100%);
  color: #000;
  align-self: flex-end;
  margin-left: auto;
}

.message.ai {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.message.system {
  background: rgba(0, 191, 255, 0.25);
  color: var(--accent-color);
  align-self: center;
  font-size: 12px;
  font-style: italic;
}

#chat-input {
  display: flex;
  padding: 20px 25px;
  background: rgba(40, 40, 40, 0.9);
  gap: 12px;
}

#chat-text {
  flex: 1;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 25px;
  padding: 14px 20px;
  color: #ffffff;
  font-size: 15px;
  outline: none;
}

#chat-text::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

#chat-send {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #00dd77 100%);
  border: none;
  border-radius: 25px;
  padding: 14px 24px;
  color: #000;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
  font-size: 15px;
}

#chat-send:hover {
  transform: scale(1.05);
}

/* Log Panel */
#log-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 10, 0.98);
  backdrop-filter: blur(15px);
  display: flex;
  flex-direction: column;
  z-index: 200;
}

#log-output {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  font-size: 11px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
  background: rgba(0, 0, 0, 0.7);
  color: #00ff88;
  white-space: pre-wrap;
  line-height: 1.3;
}

#log-controls {
  display: flex;
  gap: 10px;
  padding: 15px 20px;
  background: rgba(40, 40, 40, 0.9);
}

#clear-logs, #send-logs {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
}

#send-logs {
  background: linear-gradient(135deg, var(--accent-color) 0%, #0099cc 100%);
  color: #000;
  font-weight: 600;
}

/* Content Area */
#content-area {
  flex: 1;
  padding: 25px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Role Selection */
#role-select {
  text-align: center;
  width: 100%;
}

#role-select h2 {
  margin-bottom: 15px;
  color: var(--text-color);
  font-weight: 300;
  font-size: 20px;
}

.pilot-note {
  color: var(--secondary-color);
  font-size: 12px;
  margin-bottom: 25px;
  font-style: italic;
}

#role-select button {
  display: block;
  width: 100%;
  max-width: 220px;
  margin: 12px auto;
  padding: 16px 20px;
  background: var(--card-bg);
  border: 1px solid #444;
  border-radius: 15px;
  color: var(--text-color);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.day #role-select button {
  border: 1px solid #ccc;
}

#role-select button:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 255, 136, 0.25);
  border-color: var(--secondary-color);
}

/* Menu */
#menu {
  list-style: none;
  width: 100%;
  max-width: 280px;
}

#menu li {
  padding: 15px 22px;
  margin: 8px 0;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
  font-size: 15px;
}

#menu li:hover {
  background: rgba(0, 255, 136, 0.15);
  border-left-color: var(--secondary-color);
  transform: translateX(5px);
}

#menu li.active {
  background: linear-gradient(90deg, rgba(0, 255, 136, 0.25) 0%, rgba(0, 191, 255, 0.25) 100%);
  border-left-color: var(--secondary-color);
  transform: translateX(5px);
}

/* Status Grid */
.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 20px;
}

.status-card {
  background: rgba(255, 255, 255, 0.08);
  padding: 15px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.status-value {
  font-weight: 600;
  font-size: 16px;
}

.status-value.online {
  color: var(--secondary-color);
  font-size: 20px;
}

/* Click Wheel */
#click-wheel {
  height: 180px;
  width: 180px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3a3a3a 0%, #2a2a2a 100%);
  margin: 20px auto 25px;
  position: relative;
  box-shadow: 
    inset 8px 8px 16px #1a1a1a,
    inset -8px -8px 16px #4a4a4a;
}

body.day #click-wheel {
  background: linear-gradient(145deg, #e0e0e0 0%, #d0d0d0 100%);
  box-shadow: 
    inset 8px 8px 16px #c0c0c0,
    inset -8px -8px 16px #f0f0f0;
}

.button {
  position: absolute;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
  background: linear-gradient(145deg, #333333 0%, #1f1f1f 100%);
  box-shadow: 
    5px 5px 10px #1a1a1a,
    -5px -5px 10px #4a4a4a;
  user-select: none;
}

body.day .button {
  background: linear-gradient(145deg, #f0f0f0 0%, #e0e0e0 100%);
  box-shadow: 
    5px 5px 10px #c0c0c0,
    -5px -5px 10px #ffffff;
}

.button:hover {
  transform: scale(1.15);
}

.button:active {
  transform: scale(0.95);
  box-shadow: 
    inset 3px 3px 6px #1a1a1a,
    inset -3px -3px 6px #4a4a4a;
}

.button.top { top: 8px; left: 67px; }
.button.left { top: 67px; left: 8px; }
.button.center { 
  top: 67px; 
  left: 67px; 
  background: linear-gradient(145deg, var(--secondary-color) 0%, #00dd77 100%);
  color: #000;
  font-size: 22px;
}
.button.right { top: 67px; right: 8px; }
.button.bottom { bottom: 8px; left: 67px; }

/* Voice Overlay */
#voice-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(15px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.mic-icon {
  font-size: 90px;
  margin-bottom: 25px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}

#voice-transcript {
  font-size: 20px;
  margin-bottom: 35px;
  text-align: center;
  color: #ffffff;
  max-width: 80%;
}

#voice-cancel {
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
  border: none;
  border-radius: 30px;
  padding: 15px 30px;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#voice-cancel:hover {
  transform: scale(1.05);
}

/* Connection Status */
#connection-status {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 50;
}

#connection-status.online {
  background: rgba(0, 255, 136, 0.2);
  color: var(--secondary-color);
  border: 1px solid var(--secondary-color);
}

#connection-status.offline {
  background: rgba(255, 68, 68, 0.2);
  color: #ff4444;
  border: 1px solid #ff4444;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(25px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Optimizations */
@media (max-width: 480px) {
  body {
    padding: 5px;
  }
  
  #ipod-body {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }
  
  #click-wheel {
    height: 150px;
    width: 150px;
    margin: 15px auto 20px;
  }
  
  .button {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  
  .button.top { top: 8px; left: 56px; }
  .button.left { top: 56px; left: 8px; }
  .button.center { top: 56px; left: 56px; }
  .button.right { top: 56px; right: 8px; }
  .button.bottom { bottom: 8px; left: 56px; }
  
  #content-area {
    padding: 20px;
  }
  
  #logo {
    font-size: 24px;
    letter-spacing: 2px;
  }
  
  header {
    height: 55px;
    padding: 0 20px;
  }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
  #ipod-body {
    height: 100vh;
    max-height: none;
  }
  
  #click-wheel {
    height: 120px;
    width: 120px;
    margin: 10px auto 15px;
  }
  
  .button {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .button.top { top: 6px; left: 44px; }
  .button.left { top: 44px; left: 6px; }
  .button.center { top: 44px; left: 44px; }
  .button.right { top: 44px; right: 6px; }
  .button.bottom { bottom: 6px; left: 44px; }
}