/* Color System */
:root {
  /* Color Palette */
  --color-white: #fff;
  --color-black: #000;
  
  --color-gray-50: #f0f0f0;
  --color-gray-100: #f5f5f5;
  --color-gray-400: #666666;
  
  --color-green-50: #e8f5e9;
  --color-green-700: #2e7d32;
  
  --color-red-50: #ffebee;
  --color-red-100: #fee;
  --color-red-200: #fcc;
  --color-red-700: #c62828;
  --color-red-800: #c00;

  /* Semantic Color Tokens */
  --text-primary: var(--color-black);
  --text-secondary: var(--color-gray-400);
  --text-error: var(--color-red-800);
  --text-success: var(--color-green-700);

  --background-primary: var(--color-white);
  --background-secondary: var(--color-gray-50);
  --background-error: var(--color-red-100);
  --background-success: var(--color-green-50);
  
  --border-error: var(--color-red-200);
  
  --surface-overlay: rgba(255, 255, 255, 0.9);
  --shadow-primary: rgba(0, 0, 0, 0.1);

  /* Add smooth transitions when changing themes */
  --theme-transition-time: 0.3s;
}

/* Dark theme example - uncomment and modify as needed */
/*
[data-theme="dark"] {
  --text-primary: var(--color-white);
  --text-secondary: var(--color-gray-100);
  --background-primary: #121212;
  --background-secondary: #242424;
  --surface-overlay: rgba(0, 0, 0, 0.9);
  --shadow-primary: rgba(0, 0, 0, 0.3);
}
*/

/* Base styles */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--background-primary);
  transition: background-color var(--theme-transition-time), color var(--theme-transition-time);
}

.container {
  max-width: min(1200px, 90vw);
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.image-container {
  width: 100%;
  position: relative;
  aspect-ratio: 16/9;
  background: var(--background-secondary);
  margin: 20px 0;
}

.image-display {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
  transition: opacity 1.3s ease-in-out;
}

.image-display.loading {
  opacity: 0.25;
}
.image-text-container {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.text-content {
  flex: 1;
  max-width: 300px;
  min-height: 100px;
  width: 20%;
  padding: 1rem;
  background: var(--surface-overlay);
  border-radius: 4px;
  box-shadow: 0 2px 4px var(--shadow-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--theme-transition-time);
}

.text-content:empty::before {
  content: "No description available";
  color: var(--text-secondary);
  font-style: italic;
}

.image-container {
  flex: 2;
}

/* Error message styling */
.error-message {
  display: none;
  background-color: var(--background-error);
  border: 1px solid var(--border-error);
  color: var(--text-error);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 4px;
  width: 100%;
  text-align: center;
}

.status-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  z-index: 100;
}

.connection-status {
  position: relative;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: all var(--theme-transition-time);
}

.connection-status.connected {
  background-color: var(--background-success);
  color: var(--text-success);
}

.connection-status.disconnected {
  background-color: var(--background-error);
  color: var(--text-error);
}

/* Responsive design */

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  h1 {
    font-size: 1.5rem;
    text-align: center;
  }

  .image-container {
    aspect-ratio: 4/3;
  }
  .image-text-container {
    flex-direction: column;
  }

  .text-content {
    max-width: 100%;
    order: 2; /* Text always below image on mobile */
  }
}

@media (max-width: 480px) {
  .container {
    padding: 5px;
  }

  h1 {
    font-size: 1.25rem;
  }
}

/* Add transitions to elements that change with theme */
.text-content,
.error-message,
.connection-status {
  transition: background-color var(--theme-transition-time),
              color var(--theme-transition-time),
              border-color var(--theme-transition-time),
              box-shadow var(--theme-transition-time);
}

.theme-selector {
  position: relative;
  z-index: 100;
}

.theme-selector select {
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--text-secondary);
  background: var(--background-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--theme-transition-time);
  min-width: 120px;
}

.theme-selector select:hover {
  border-color: var(--text-primary);
}

/* Remove the old theme toggle button styles if any exist */
.theme-toggle {
  display: none;
}
