/* YC Startup Level Polished UI - Device Server Dashboard */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Modern Color Palette */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* Neutral Grays */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantic Colors */
  --success-50: #ecfdf5;
  --success-100: #d1fae5;
  --success-500: #10b981;
  --success-600: #059669;

  --error-50: #fef2f2;
  --error-100: #fee2e2;
  --error-500: #ef4444;
  --error-600: #dc2626;

  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-500: #f59e0b;
  --warning-600: #d97706;

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 72px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 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);

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  background: linear-gradient(135deg, var(--gray-50) 0%, #ffffff 100%);
  color: var(--gray-900);
  line-height: 1.6;
  margin: 0;
  padding: 0;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
}

.sidebar-header {
  padding: 2rem 1.5rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  background: linear-gradient(135deg, var(--primary-50) 0%, #ffffff 100%);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--gray-900);
  text-decoration: none;
  transition: all 0.2s ease;
}

.sidebar-logo:hover {
  color: var(--primary-600);
  transform: translateY(-1px);
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 0;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 2rem;
}

.nav-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 1.5rem;
  margin-bottom: 0.75rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.5rem;
  margin: 0.125rem 0.75rem;
  border-radius: var(--radius-lg);
  color: var(--gray-600);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--primary-500);
  border-radius: 0 2px 2px 0;
  transition: height 0.2s ease;
}

.nav-link:hover {
  background: var(--gray-50);
  color: var(--gray-900);
  transform: translateX(4px);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: white;
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.nav-link.active::before {
  height: 20px;
}

.nav-link-icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform 0.2s ease;
}

.nav-link:hover .nav-link-icon {
  transform: scale(1.1);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content header {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.content-area {
  padding: 2rem;
  flex: 1;
}

/* Cards */
.card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  background: linear-gradient(135deg, var(--gray-50) 0%, #ffffff 100%);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
  line-height: 1.5;
}

.card-content {
  padding: 1.5rem;
}

/* Statistics Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: linear-gradient(135deg, #ffffff 0%, var(--gray-50) 100%);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

/* .stat-card:hover::before {
  transform: scaleX(1);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-200);
} */

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card-icon {
  width: 1rem;
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.stat-card-icon.primary {
  background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  color: var(--primary-600);
}

.stat-card-icon.success {
  background: linear-gradient(135deg, var(--success-100) 0%, var(--success-200) 100%);
  color: var(--success-600);
}

.stat-card-icon.error {
  background: linear-gradient(135deg, var(--error-100) 0%, var(--error-200) 100%);
  color: var(--error-600);
}

.stat-card-icon.warning {
  background: linear-gradient(135deg, var(--warning-100) 0%, var(--warning-200) 100%);
  color: var(--warning-600);
}

/* .stat-card:hover .stat-card-icon {
  transform: scale(1.1) rotate(5deg);
} */

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-card-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card-change {
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

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

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

/* Search */
.search-container {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  background: #ffffff;
  color: var(--gray-900);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-100), var(--shadow-md);
  transform: translateY(-1px);
}

.search-input::placeholder {
  color: var(--gray-400);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  color: var(--gray-400);
  transition: color 0.2s ease;
}

.search-container:focus-within .search-icon {
  color: var(--primary-500);
}

/* Tables */
.table-container {
  background: #ffffff;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

.data-table thead {
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
}

.data-table th {
  padding: 1.25rem 1.5rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--gray-200);
  position: relative;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  background: var(--primary-50);
  color: var(--primary-700);
}

.data-table tbody tr {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid var(--gray-100);
}

/* Removed hover effects per user request */

.data-table td {
  padding: 1rem 1.5rem;
  color: var(--gray-600);
  font-size: 0.875rem;
  line-height: 1.5;
  vertical-align: middle;
}

.data-table td:first-child {
  font-weight: 600;
  color: var(--gray-700);
}

/* Status Indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-md);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.status-indicator:hover {
  transform: scale(1.05);
}

.status-online {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-weight: 600;
}

.status-offline {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  font-weight: 600;
}

.status-warning {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fcd34d;
  font-weight: 600;
}

.status-ready {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-weight: 600;
}

.status-hold {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fcd34d;
  font-weight: 600;
}

.status-connected {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-weight: 600;
}

.status-disconnected {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
}

.btn-secondary {
  background: #ffffff;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-error {
  background: linear-gradient(135deg, var(--error-500) 0%, var(--error-600) 100%);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-error:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, var(--error-600) 0%, var(--error-700) 100%);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.625rem;
  border-radius: var(--radius-sm);
  line-height: 1;
}

/* Table Action Buttons */
.btn-table-action {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid;
  white-space: nowrap;
}

.btn-table-view {
  background: #ffffff;
  color: #374151;
  border-color: #d1d5db;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-table-view:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #1f2937;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.btn-table-action-primary {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-table-action-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.btn-table-action:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2563eb;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Links */
.data-table a {
  color: var(--primary-600);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  border-radius: var(--radius-sm);
  padding: 0.125rem 0.25rem;
}

.data-table a:hover {
  color: var(--primary-700);
  background: var(--primary-50);
  transform: translateY(-1px);
}

/* Action Buttons Container */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--gray-200);
}

.page-header h1 {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0;
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-700) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header p {
  color: var(--gray-500);
  margin: 0.25rem 0 0 0;
  font-size: 0.875rem;
}

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

.last-updated {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 500;
}

/* Footer */
.page-footer {
  border-top: 1px solid var(--gray-200);
  padding: 2rem;
  margin-top: 3rem;
  background: linear-gradient(135deg, var(--gray-50) 0%, #ffffff 100%);
  text-align: center;
}

.footer-content {
  color: var(--gray-500);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .content-area {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
  }

  .page-actions {
    align-self: stretch;
    justify-content: space-between;
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.5s ease-out;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }

  100% {
    background-position: calc(200px + 100%) 0;
  }
}

/* Ripple Effect */
.btn {
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple-animation 0.6s linear;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Loading states */
.btn.loading {
  pointer-events: none;
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1rem;
  height: 1rem;
  margin: -0.5rem 0 0 -0.5rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-primary.loading::after {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: white;
}

.btn-secondary.loading::after {
  border-color: rgba(107, 114, 128, 0.3);
  border-top-color: var(--gray-600);
}

/* Dark mode support hint for future */
@media (prefers-color-scheme: dark) {
  /* Future dark mode implementation */
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Utility classes */
.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;
}

.space-y-6>*+* {
  margin-top: 1.5rem;
}

.space-y-4>*+* {
  margin-top: 1rem;
}

.space-y-2>*+* {
  margin-top: 0.5rem;
}

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

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

/* Mobile menu button styling */
.mobile-menu-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  display: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex !important;
  }
}