/* CSS Custom Properties */
:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --white: #ffffff;
  --black: #000000;
  
  --background-color: #f5f5f5;
  --card-background: #ffffff;
  --border-color: #dee2e6;
  --text-color: #212529;
  --text-muted: #6c757d;
  
  --border-radius: 8px;
  --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--box-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-email {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Main Content */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* Footer */
.footer {
  background: var(--white);
  border-top: 1px solid var(--border-color);
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

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

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: var(--white);
}

.btn-secondary:hover {
  background-color: #545b62;
}

.btn-danger {
  background-color: var(--danger-color);
  color: var(--white);
}

.btn-danger:hover {
  background-color: #c82333;
}

.btn-full {
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
}

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

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.dashboard-header h2 {
  font-size: 2rem;
  font-weight: 600;
}

/* Streams Grid */
.streams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stream-card {
  background: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.stream-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.stream-thumbnail {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--dark-color);
  overflow: hidden;
}

.stream-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stream-thumbnail .placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--white);
  font-size: 3rem;
}

.stream-status {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.stream-status.live {
  background: var(--danger-color);
  color: var(--white);
}

.stream-status.offline {
  background: rgba(0, 0, 0, 0.7);
  color: var(--white);
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.stream-info {
  padding: 1rem;
}

.stream-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.stream-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  overflow-y: auto;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-content {
  background: var(--card-background);
  border-radius: var(--border-radius);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-body video {
  width: 100%;
  max-width: 800px;
  height: auto;
  border-radius: var(--border-radius);
}

/* Login */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.login-card {
  background: var(--card-background);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  width: 100%;
  max-width: 400px;
}

.login-card h2 {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--primary-color);
}

.code-sent-message {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--success-color);
  font-weight: 500;
}

/* Shared Stream */
.shared-stream-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.password-card {
  background: var(--card-background);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.password-card h2 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.stream-player {
  max-width: 800px;
  margin: 0 auto;
}

.stream-player h2 {
  margin-bottom: 1rem;
  text-align: center;
}

.stream-description {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* Share Results */
.share-result {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--light-color);
  border-radius: var(--border-radius);
}

.share-result h4 {
  margin-bottom: 1rem;
  color: var(--success-color);
}

.copy-field {
  display: flex;
  gap: 0.5rem;
}

.copy-field input {
  flex: 1;
}

.qr-code {
  text-align: center;
  margin-top: 1rem;
}

.qr-code img {
  max-width: 200px;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

/* Messages */
.message {
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border-radius: var(--border-radius);
  border: 1px solid transparent;
}

.message.success {
  background: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

.message.error {
  background: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

.message.info {
  background: #cce7ff;
  color: #004085;
  border-color: #b3d7ff;
}

/* Error Page */
.error-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.error-card {
  background: var(--card-background);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  text-align: center;
  max-width: 400px;
}

.error-card h2 {
  margin-bottom: 1rem;
  color: var(--danger-color);
}

.error-card p {
  margin-bottom: 2rem;
  color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
  .main {
    padding: 1rem;
  }
  
  .header-content {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }
  
  .dashboard-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .streams-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .modal.show {
    padding: 1rem;
  }
  
  .modal-content {
    max-width: 100%;
    max-height: 100%;
  }
  
  .modal-header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }
  
  .modal-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .copy-field {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .header-title {
    font-size: 1.25rem;
  }
  
  .dashboard-header h2 {
    font-size: 1.5rem;
  }
  
  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
  }
  
  .stream-card {
    margin-bottom: 1rem;
  }
}

/* Touch optimizations for mobile */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
  }
  
  .stream-card {
    transition: none;
  }
  
  .stream-card:hover {
    transform: none;
  }
  
  .stream-card:active {
    transform: scale(0.98);
  }
}

/* GodMode Button */
.btn-godmode {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-godmode:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.dashboard-header .header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}
