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

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-color: #64748b;
  --secondary-hover: #475569;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --text-color: #1e293b;
  --text-light: #64748b;
  --bg-color: #f8fafc;
  --bg-sidebar: #1e293b;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 0.25rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

.container {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* Sidebar Styles */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  color: white;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
  background-color: var(--primary-color);
  font-weight: 500;
}

.room-status {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  background-color: var(--success-color);
  border-radius: 50%;
}

/* Content Styles */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

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

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-color);
}

/* Home Page */
.clock-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2rem 0;
}

.clock-wrapper {
  text-align: center;
}

#clock {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

#date {
  font-size: 1.25rem;
  color: var(--text-light);
}

.quick-actions {
  margin-top: 3rem;
}

.quick-actions h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-color);
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.action-btn svg {
  color: var(--primary-color);
}

.action-btn span {
  font-weight: 500;
}

.action-btn.power-all svg {
  color: var(--danger-color);
}

/* Room Layout Page */
.room-layout-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.room-visualization {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  height: 400px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.room-visual {
  width: 100%;
  height: 100%;
  display: flex;
  position: relative;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.room-half {
  flex: 1;
  padding: 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
}

.room-divider {
  width: 10px;
  background-color: var(--secondary-color);
  position: relative;
}

.room-visual.split .room-divider {
  background-color: var(--danger-color);
}

.display {
  background-color: #e2e8f0;
  padding: 0.5rem;
  text-align: center;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.main-display {
  background-color: #cbd5e1;
  font-weight: 500;
}

.input-source {
  background-color: #f1f5f9;
  padding: 0.5rem;
  text-align: center;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  font-size: 0.875rem;
  border: 1px dashed var(--border-color);
}

.room-controls {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.room-controls h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.control-group {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.room-info {
  margin-top: 2rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

.room-info p {
  margin-bottom: 0.5rem;
}

.room-info .note {
  font-style: italic;
  font-size: 0.75rem;
}

/* Routing Page */
.routing-container {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.routing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.routing-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.routing-group h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.source-selector {
  display: flex;
  gap: 0.5rem;
}

.source-btn {
  padding: 0.5rem 1rem;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  text-align: center;
}

.source-btn:hover {
  background-color: #f1f5f9;
}

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

.routing-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  justify-content: flex-end;
}

/* Audio Control Page */
.audio-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.audio-section {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.audio-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.volume-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e2e8f0;
  border-radius: 3px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
}

.volume-value {
  min-width: 50px;
  text-align: right;
  font-weight: 500;
}

.audio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.audio-column {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.audio-column h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.audio-group {
  margin-bottom: 2rem;
}

.audio-group h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

/* Lighting & Shades Page */
.lighting-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.lighting-section {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.lighting-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  background-color: #f1f5f9;
  transform: translateY(-2px);
}

.preset-btn svg {
  color: var(--primary-color);
}

.lighting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.lighting-column {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.lighting-column h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.lighting-group {
  margin-bottom: 2rem;
}

.lighting-group h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.slider-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.lighting-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e2e8f0;
  border-radius: 3px;
  outline: none;
}

.lighting-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--warning-color);
  border-radius: 50%;
  cursor: pointer;
}

.slider-value {
  min-width: 50px;
  text-align: right;
  font-weight: 500;
}

.shade-controls {
  display: flex;
  gap: 1rem;
}

.lighting-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

/* Device Controls Page */
.device-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.device-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.device-column {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.device-column h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.device-group {
  margin-bottom: 2rem;
}

.device-group h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.device-controls {
  display: flex;
  gap: 1rem;
}

.btn-power {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
}

.btn-power.on {
  color: var(--success-color);
}

.btn-power.off {
  color: var(--danger-color);
}

.btn-power:hover {
  background-color: #f1f5f9;
}

.device-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

/* Button Styles */
.btn-primary {
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

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

.btn-primary.active {
  background-color: var(--primary-hover);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
  padding: 0.75rem 1.5rem;
  background-color: var(--bg-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

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

/* Responsive Adjustments */
@media (max-width: 1024px) {
  .room-layout-container,
  .routing-grid,
  .audio-grid,
  .lighting-grid,
  .device-grid {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    width: 80px;
  }
  
  .sidebar .logo h2,
  .sidebar .nav-item span,
  .sidebar .room-status {
    display: none;
  }
  
  .sidebar .nav-item {
    justify-content: center;
    padding: 1rem;
  }
  
  .sidebar .logo {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 1rem;
  }
  
  .action-buttons {
    grid-template-columns: 1fr;
  }
  
  .source-selector,
  .device-controls,
  .shade-controls {
    flex-direction: column;
  }
}