:root {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --background-color: #f8f9fa;
  --border-color: #dee2e6;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  background-color: var(--background-color);
  font-weight: 400;
  font-size: 0.9rem; /* Reduced font size for overall scaling */
}

.app-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  letter-spacing: -0.5px;
}

.container {
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-tabs {
  border: none;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: nowrap;
  height: 42px;
  overflow: hidden;
  background: var(--background-color);
  padding: 4px 4px 0 4px;
  box-shadow: none;
}

.nav-tabs .nav-link {
  padding: 0.6rem 1.2rem;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: 0;
  color: var(--secondary-color);
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
  transition: all 0.2s;
  position: relative;
  top: 1px;
  font-size: 0.9rem;
  background: transparent;
}

.nav-tabs .nav-link:hover:not(.active) {
  background: rgba(255,255,255,0.8);
  border-color: #e9ecef;
  color: var(--primary-color);
}

.nav-tabs .nav-link.active {
  color: var(--primary-color);
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-bottom: 2px solid var(--background-color);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: none;
}

.table-responsive {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 1rem;
}

.table {
  margin-bottom: 0;
}

.table th {
  background-color: white;
  font-weight: 600;
  padding: 0.8rem; /*Reduced padding*/
  white-space: nowrap;
  font-size: 0.9rem; /*Reduced font size*/
}

.table td {
  padding: 0.8rem; /*Reduced padding*/
  vertical-align: middle;
  font-size: 0.9rem; /*Reduced font size*/
}

.id-column,
td:nth-child(2) {
  display: none;
}

.btn {
  padding: 0.4rem 0.8rem; /*Reduced padding*/
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s;
  font-size: 0.9rem; /*Reduced font size*/
}

.btn-sm {
  padding: 0.2rem 0.4rem; /*Reduced padding*/
}

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

.btn-primary:hover {
  background-color: #0b5ed7;
  transform: translateY(-1px);
}

.form-control {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.modal-content {
  border-radius: 10px; /*Slightly reduced border radius*/
  border: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08); /*Reduced shadow*/
  font-size: 0.9rem; /*Reduced font size*/
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 0.8rem 1.2rem; /*Reduced padding*/
}

.modal-body {
  padding: 1.2rem; /*Reduced padding*/
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 0.8rem 1.2rem; /*Reduced padding*/
}

.image-container {
  position: relative;
}

.table img.thumbnail {
  width: 35px; /* Reduced size */
  height: 35px; /* Reduced size */
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.table img.thumbnail:hover {
  transform: scale(1.1);
}

.image-preview {
  display: none;
  position: fixed;
  z-index: 1000;
  width: 180px; /* Reduced size */
  height: 180px; /* Reduced size */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  pointer-events: none;
}

.image-container:hover .image-preview {
  display: block;
}

@media (max-width: 768px) {
  .container {
    padding: 0.5rem;
    width: 100%;
  }

  .form-control[id$="Search"] {
    width: 100%;
    max-width: none;
    margin: 0 0.5rem 1rem 0.5rem;
    font-size: 16px;
    height: 40px;
    flex: 1;
  }

  .d-flex {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .nav-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .nav-tabs .nav-link {
    white-space: nowrap;
    padding: 0.5rem 1rem;
  }

  .table-responsive {
    margin: 0 -0.5rem;
    border-radius: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .modal-dialog {
    margin: 0.5rem;
    max-width: 95%;
  }

  .form-control {
    font-size: 16px;
    width: 100%;
  }

  .computer-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .computer-card {
    padding: 0.6rem;
  }

  .computer-info h3 {
    font-size: 0.85rem;
  }

  .computer-info p {
    font-size: 0.75rem;
  }

  .action-icon {
    font-size: 1.2rem;
    margin: 0 0.3rem;
    padding: 0.3rem;
  }
}

.action-icon {
  font-size: 1rem;
  margin: 0 0.4rem;
}

.table td .action-icon {
  cursor: pointer;
}

.action-icon:hover {
  transform: scale(1.2);
}

[title] {
  position: relative;
  cursor: help;
}

.card {
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.card-header {
  padding: 0.8rem 1.2rem;
  border-radius: 8px 8px 0 0;
}

.progress {
  background-color: #e9ecef;
  border-radius: 4px;
}

.badge {
  padding: 0.4em 0.6em;
  font-size: 0.85rem;
}

.computer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.8rem;
  padding: 0.8rem;
}

.computer-card {
  background: white;
  border-radius: 8px;
  padding: 0.8rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
  position: relative;
  overflow: hidden;
}

.computer-card:hover {
  transform: translateY(-5px);
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.status-online {
  background: #28a745;
  box-shadow: 0 0 0 rgba(40, 167, 69, 0.4);
  animation: pulse 2s infinite;
}

.status-idle {
  background: #ffc107;
}

.status-offline {
  background: #dc3545;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

.computer-info {
  margin-top: 0.5rem;
}

.computer-info h3 {
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.computer-info p {
  margin: 0.15rem 0;
  color: var(--secondary-color);
  font-size: 0.8rem;
}

.computer-details {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.8rem;
}

#toastContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.console-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.25rem;
  padding: 0.25rem;
  width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
  height: calc(100vh - 150px);
  overflow-y: auto;
  position: fixed;
  top: 150px;
  left: 0;
  align-content: start;
}

.console-window {
  background: #1e1e1e;
  border-radius: 4px;
  height: 150px;
  width: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
  font: 12px 'Consolas', monospace;
}

.console-window.expanded {
  height: 400px;
  width: 200%;
  max-width: calc(100vw - 40px);
  z-index: 100;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  position: absolute;
  right: 20px;
}

.expand-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #444;
  border: none;
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  z-index: 10;
}

.expand-button:hover {
  background: #555;
}

.console-header {
  background: #333;
  color: #fff;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-bottom: 1px solid #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.active {
  background: #4CAF50;
  box-shadow: 0 0 4px #4CAF50;
}

.status-dot.inactive {
  background: #f44336;
  box-shadow: 0 0 4px #f44336;
}

.header-right {
  font-size: 0.7rem;
  color: #888;
}

.console-body {
  color: #fff;
  padding: 0.5rem;
  overflow-y: auto;
  flex-grow: 1;
  font-size: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: #666 #1e1e1e;
}

.console-body::-webkit-scrollbar {
  width: 6px;
}

.console-body::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.console-body::-webkit-scrollbar-thumb {
  background-color: #666;
  border-radius: 3px;
}

.console-message {
  margin: 0.15rem 0;
  word-wrap: break-word;
  line-height: 1.2;
}

.console-message .timestamp {
  display: none;
  color: #666;
  margin-right: 0.3rem;
  font-size: 0.7rem;
}

.console-window.expanded .console-message .timestamp {
  display: inline;
}

.console-message .content {
  color: #0f0;
}