/* Modern Digital Signage CMS - 2025 Design System */

:root {
  /* Color System - Modern Neutrals with Lucid Accent */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  --accent: #000000;
  --accent-50: #f8f9fa;
  --accent-100: #f1f3f4;
  --accent-500: #000000;
  --accent-600: #1a1a1a;
  --accent-900: #0a0a0a;
  
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  
  /* Surface Colors */
  --background: #ffffff;
  --surface: #ffffff;
  --surface-elevated: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  
  /* Text Colors */
  --text-primary: #000000;
  --text-secondary: #333333;
  --text-muted: #666666;
  --text-inverse: #ffffff;
  
  /* Spacing Scale */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  
  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Border Radius */
  --radius-none: 0;
  --radius-sm: 0.25rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.1);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  
  /* Transitions */
  --transition-all: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-colors: color 200ms cubic-bezier(0.4, 0, 0.2, 1), background-color 200ms cubic-bezier(0.4, 0, 0.2, 1), border-color 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-transform: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Layout */
  --sidebar-width: 16rem;
  --header-height: 4rem;
  --content-max-width: 80rem;
}

/* Dark Theme */
[data-theme="dark"] {
  --background: #000000;
  --surface: #0a0a0a;
  --surface-elevated: #1a1a1a;
  --surface-hover: #2a2a2a;
  --border: #333333;
  --border-strong: #444444;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #999999;
  --accent-50: rgba(255, 255, 255, 0.08);
  --accent-100: rgba(255, 255, 255, 0.12);
  --gray-50: #1a1a1a;
  --gray-100: #2a2a2a;
  --gray-200: #333333;
  --gray-300: #444444;
  --gray-400: #555555;
  --gray-500: #666666;
  --gray-600: #777777;
  --gray-700: #888888;
  --gray-800: #cccccc;
  --gray-900: #ffffff;
}

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

html {
  font-family: 'Inter var', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--background);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: var(--transition-colors);
  min-height: 100vh;
}

/* Modern Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: 1.25;
  letter-spacing: -0.025em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p {
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Modern Layout System */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas: 
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
}

.app-header {
  grid-area: header;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-6);
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}

.app-main {
  grid-area: main;
  padding: var(--space-6);
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}

/* Modern Navigation */
.nav-brand {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav-brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  height: 2.5rem;
}

.nav-brand-logo img {
  height: 2rem;
  width: auto;
  width:100px;
  object-fit: contain;
}

.logo-light {
  display: block;
}

.logo-dark {
  display: none;
}

[data-theme="dark"] .logo-light {
  display: none;
}

[data-theme="dark"] .logo-dark {
  display: block;
}

.brand-text {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  letter-spacing: 0.05em;
  margin-left: var(--space-2);
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-8);
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: var(--transition-all);
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: var(--surface-hover);
  transform: translateX(2px);
}

.nav-link.active {
  color: var(--accent);
  background-color: var(--accent-50);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .nav-link.active {
  color: var(--text-primary);
  background-color: var(--accent-50);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Modern Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-all);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.card-subtitle {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}

/* Modern Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border: none;
  cursor: pointer;
  transition: var(--transition-all);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-600);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

/* Modern Form Inputs */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--surface);
  transition: var(--transition-all);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] .form-input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* Modern Checkbox */
.modern-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: var(--transition-all);
  flex-shrink: 0;
}

.modern-checkbox:hover {
  border-color: var(--accent);
}

.modern-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

[data-theme="dark"] .modern-checkbox:checked {
  background: #ffffff;
  border-color: #ffffff;
}

.modern-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

[data-theme="dark"] .modern-checkbox:checked::after {
  border-color: #000000;
}

/* Modern Status Indicators */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-online {
  background: rgb(16 185 129 / 0.1);
  color: var(--success);
  border: 1px solid rgb(16 185 129 / 0.2);
}

.status-online::before {
  background: var(--success);
}

.status-offline {
  background: rgb(239 68 68 / 0.1);
  color: var(--error);
  border: 1px solid rgb(239 68 68 / 0.2);
}

.status-offline::before {
  background: var(--error);
}

.status-warning {
  background: rgb(245 158 11 / 0.1);
  color: var(--warning);
  border: 1px solid rgb(245 158 11 / 0.2);
}

.status-warning::before {
  background: var(--warning);
}

/* Modern Data Visualization */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: var(--transition-all);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}

[data-theme="dark"] .stat-card::before {
  background: #ffffff;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.stat-label {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.stat-change {
  font-size: var(--text-xs);
  margin-top: var(--space-2);
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--error);
}

/* Modern Content Grid */
.content-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Modern Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-all);
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  max-width: 32rem;
  width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95);
  transition: var(--transition-all);
}

[data-theme="dark"] .modal-content {
  box-shadow: var(--shadow-2xl), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.modal.show .modal-content {
  transform: scale(1);
}

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

.modal-body {
  padding: var(--space-6);
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* Utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.show {
  display: block !important;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }

.hidden { display: none !important; }
.block { display: block; }
.show { display: block !important; }

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

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

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-fade-in {
  animation: fadeIn 300ms ease-out;
}

/* Grid utilities */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.gap-4 {
  gap: var(--space-4);
}

.space-y-2 > * + * {
  margin-top: var(--space-2);
}

.space-y-4 > * + * {
  margin-top: var(--space-4);
}

/* Layout & Panel Table Styling */
#layoutsList table,
#layoutsList thead,
#layoutsList tbody,
#layoutsList tr,
#panelsList table,
#panelsList thead,
#panelsList tbody,
#panelsList tr {
  border-collapse: collapse;
  border-spacing: 0;
}

#layoutsList thead tr,
#panelsList thead tr {
  background: #000000 !important;
}

[data-theme="dark"] #layoutsList thead tr,
[data-theme="dark"] #panelsList thead tr {
  background: #ffffff !important;
}

#layoutsList thead th,
#panelsList thead th {
  background: transparent;
  color: white;
  font-weight: var(--font-semibold);
  text-transform: none;
  border: none;
  padding: var(--space-3) var(--space-4);
}

[data-theme="dark"] #layoutsList thead th,
[data-theme="dark"] #panelsList thead th {
  color: #000000;
}

#layoutsList tbody tr,
#panelsList tbody tr {
  border-bottom: 1px solid var(--border);
}

#layoutsList tbody tr:hover,
#panelsList tbody tr:hover {
  background: var(--surface-hover);
}

#layoutsList tbody td,
#panelsList tbody td {
  padding: var(--space-3) var(--space-4);
}

.w-full {
  width: 100%;
}

@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas: 
      "header"
      "main";
  }
  
  .app-sidebar {
    display: none;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .content-grid {
    grid-template-columns: 1fr;
  }
}

/* Dark mode toggle */
.theme-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-all);
}

.theme-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: var(--transition-transform);
}

[data-theme="dark"] .theme-toggle::after {
  transform: translateX(24px);
}