:root {
  --primary: #ff3333;
  --primary-dark: #cc0000;
  --primary-light: rgba(255, 51, 51, 0.1);
  --bg-dark: #0f0f0f;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #888888;
  --border: rgba(255, 51, 51, 0.15);
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a1a 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  font-variant-emoji: emoji;
}

.emoji {
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  font-variant-emoji: emoji;
}

.centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-lg {
  max-width: 900px;
}

.card-xl {
  max-width: 1200px;
}

.card-header {
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: 0;
}

h1, h2, h3, h4 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-weight: 700;
}

h1 {
  font-size: 2rem;
  color: var(--primary);
  text-shadow: 0 0 20px rgba(255, 0, 0, 0.2);
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-secondary);
}

input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 51, 51, 0.2);
  outline: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
  text-decoration: none;
  line-height: 1;
}

.btn:hover { transform: translateY(-1px); }

.btn + .btn { margin-left: 0.75rem; }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dark);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
  transform: none;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.btn-full {
  width: 100%;
}

.app-shell {
  display: flex;
  height: 100vh; /* lock layout height so sidebar/footer don't shift */
}

.sidebar {
  width: 260px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.2);
  border-right: 1px solid var(--border);
  gap: 0.5rem;
  min-height: 100vh; /* keep full height so footer sits at bottom */
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.main-content {
  display: grid;
  gap: 2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.table-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: var(--primary);
  color: white;
}

.badge-success {
  background: var(--success);
  color: white;
}

.badge-warning {
  background: var(--warning);
  color: #111;
}

.badge-danger {
  background: var(--danger);
  color: white;
}

.badge-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.avatar {
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  position: relative;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
}

.avatar-md {
  width: 48px;
  height: 48px;
  font-size: 1rem;
}

.avatar-lg {
  width: 80px;
  height: 80px;
  font-size: 1.5rem;
}

.avatar-xl {
  width: 120px;
  height: 120px;
  font-size: 2rem;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-edit {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
  cursor: pointer;
}

.avatar:hover .avatar-edit {
  opacity: 1;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

.search-box {
  position: relative;
  max-width: 300px;
}

.search-box input {
  padding-left: 2.5rem;
}

.search-box i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-select {
  min-width: 150px;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}

.pagination-info {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Larger modal sizes for content-heavy dialogs */
.modal-lg {
  max-width: 900px;
}

.modal-xl {
  max-width: 1200px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1.25rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Responsive button layout in tight spaces */
@media (max-width: 560px) {
  .modal-footer {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }
  .modal-footer .btn {
    flex: 1 1 45%;
    min-width: 140px;
  }
}

/* Sidebar stacked spacing */
.sidebar-nav .btn + .btn,
.sidebar-footer .btn + .btn {
  margin-top: 0.5rem;
  margin-left: 0;
}

/* Staff badge styling */
.badge-info {
  background: #3498db;
  color: white;
}

.toast-container {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 350px;
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--primary);
}

.toast i {
  font-size: 1.25rem;
}

.toast.success i {
  color: var(--success);
}

.toast.error i {
  color: var(--danger);
}

.toast.info i {
  color: var(--primary);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.audit-log {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.audit-item {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: var(--transition);
  align-items: center;
  animation: fadeSlideUp 0.25s ease;
}

.audit-item:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.audit-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
}

.audit-info { min-width: 0; }

.audit-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.audit-actor {
  font-weight: 600;
  color: var(--primary);
}

.audit-action {
  font-weight: 600;
  color: var(--text-primary);
}

.audit-details {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.audit-ip {
  position: relative;
  display: inline-block;
}

.audit-ip:hover .ip-tooltip {
  display: block;
}

.ip-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  white-space: nowrap;
  z-index: 10;
  margin-bottom: 0.5rem;
}

.audit-time {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.audit-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.permission-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.permission-item.active {
  background: var(--primary-light);
  border-color: var(--primary);
}

.permission-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.permission-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  font-size: 1.25rem;
}

.permission-item.active .permission-icon {
  background: var(--primary);
  color: white;
}

.permission-label {
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

#afkWarningModal {
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;
}

#afkWarningModal .modal {
  animation: pulseWarning 2s infinite;
  border: 2px solid #f39c12;
}

@keyframes pulseWarning {
  0% { box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(243, 156, 18, 0); }
  100% { box-shadow: 0 0 0 0 rgba(243, 156, 18, 0); }
}

#afkCountdown {
  font-weight: bold;
  color: var(--primary);
  font-size: 1.2em;
  display: inline-block;
  min-width: 20px;
}

.error-message {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  margin-top: 1rem;
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
}

.input-with-button input {
  flex: 1;
}

.license-key-cell,
.expiration-cell,
.action-buttons,
.user-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-cell {
  gap: 0.75rem;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.user-info .username {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.user-role {
  font-size: 0.85rem;
  color: var(--text-light);
}

.permissions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.text-center {
  text-align: center;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 0;
  border: none;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.avatar-actions {
  margin-top: 0.5rem;
}

.audit-filters {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--text-light);
}

.admin-key-section {
  text-align: center;
  margin-top: 1.5rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.info-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.info-value {
  color: var(--text-primary);
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.permission-toggle-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.permission-toggle-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

small {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: block;
}

.license-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.form-section h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.password-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-container input {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: var(--transition);
}

.password-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.password-toggle.active {
  color: var(--primary);
}

@media (max-width: 1024px) {
  .app-shell {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    flex-direction: column; /* keep column to preserve footer visibility */
    padding: 1rem;
    overflow-x: visible;
  }
  
  .sidebar-header { display: none; }
  .sidebar-footer {
    display: flex;
    margin-left: auto;
    gap: 0.5rem;
    border-top: none;
    padding-top: 0;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 1rem;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .search-box {
    max-width: 100%;
  }
  
  .pagination {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .audit-item {
    flex-direction: column;
    gap: 1rem;
  }
  
  .audit-meta {
    justify-content: space-between;
  }
  
  .audit-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .permission-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
  }

  .permission-toggle-card {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .sidebar {
    width: 100%;
    flex-direction: column; /* keep column on small screens */
    padding: 1rem;
    overflow-x: visible;
  }

  .sidebar-header { display: none; }
  .sidebar-footer {
    display: flex;
    margin-left: auto;
    gap: 0.5rem;
    border-top: none;
    padding-top: 0;
  }

  .sidebar-nav {
    display: flex;
    gap: 0.5rem;
  }

  .btn-full {
    width: auto;
  }

  .modal {
    margin: 1rem;
    max-height: 80vh;
  }

  .modal-body {
    padding: 1rem;
  }

  .action-buttons {
    flex-direction: column;
    gap: 0.25rem;
  }

  .license-key-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .user-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .permissions-list {
    max-width: 150px;
    overflow: hidden;
  }

  .password-input-container {
    width: 100%;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .license-form {
    gap: 1rem;
  }

  .form-section {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 1.5rem;
  }

  .main-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .permission-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-header h2 {
    font-size: 1.25rem;
  }

  th, td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .toast {
    max-width: 280px;
    padding: 0.75rem 1rem;
  }

  .avatar-xl {
    width: 80px;
    height: 80px;
  }

  .avatar-lg {
    width: 60px;
    height: 60px;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .modal-header h3 {
    font-size: 1.1rem;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-dark: #0a0a0a;
    --bg-card: #151515;
    --text-muted: #666;
  }
}

@media (prefers-contrast: high) {
  :root {
    --border: rgba(255, 51, 51, 0.3);
    --text-secondary: #ffffff;
  }

  .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card,
  .modal,
  .toast,
  .audit-item {
    animation: none;
  }
}

@media print {
  .sidebar,
  .main-header,
  .btn,
  .action-buttons {
    display: none;
  }

  .main {
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #000;
  }

  table {
    border: 1px solid #000;
  }

  th, td {
    border: 1px solid #000;
    color: #000;
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

::selection {
  background: var(--primary-light);
  color: var(--text-primary);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.input-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2) !important;
}

.input-success {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2) !important;
}

.ip-tooltip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  box-shadow: var(--shadow);
  z-index: 1000;
}

@keyframes highlight {
  0% { background-color: var(--primary-light); }
  100% { background-color: transparent; }
}

.highlight-new {
  animation: highlight 2s ease;
}

.dynamic-content {
  transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 0.5rem;
  transform: scale(1.2);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
  margin-left: 0.5rem;
}

::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.btn:disabled,
input:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

tr.selected {
  background: var(--primary-light) !important;
}

code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--primary);
}

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.status-online {
  background: var(--success);
}

.status-offline {
  background: var(--text-muted);
}

.status-warning {
  background: var(--warning);
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.ml-1 { margin-left: 0.5rem; }
.mr-1 { margin-right: 0.5rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }

.d-flex { display: flex; }
.d-none { display: none; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

@media (max-width: 768px) {
  .responsive-text {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .responsive-text {
    font-size: 0.8rem;
  }
}

.modal::-webkit-scrollbar {
  width: 6px;
}

.modal::-webkit-scrollbar-thumb {
  background: var(--border);
}

@supports (backdrop-filter: blur(10px)) {
  .modal-overlay {
    backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.5);
  }
}

.gradient-text {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-card) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    var(--bg-card) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.modal {
  animation: scaleIn 0.18s ease;
}

@keyframes scaleIn {
  0% { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes fadeSlideUp {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Aggiungi queste regole CSS al file style.css esistente */

/* Analytics Styles */
.chart-container {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 1rem 0;
}

.activity-list {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.activity-content {
  flex: 1;
}

.activity-text {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.activity-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Settings Styles */
.danger-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.danger-actions .btn {
  flex: 1;
  min-width: 150px;
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.info-value {
  color: var(--text-primary);
  font-weight: 600;
}

@media (max-width: 768px) {
  .danger-actions {
    flex-direction: column;
  }
  
  .danger-actions .btn {
    width: 100%;
  }
  
  .activity-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .info-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

.loading {
  opacity: 0.6;
  pointer-events: none;
}

.skeleton {
  background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}