@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
  color-scheme: dark;
  --primary: #f97316;
  --primary-dark: #ea580c;
  --primary-light: #fb923c;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --dark: #0a0a0a;
  --dark-light: #171717;
  --dark-lighter: #262626;
  --text: #f5f5f5;
  --text-secondary: #a3a3a3;
  --border: #3f3f3f;
  --shadow: rgba(0, 0, 0, 0.6);
  --font-main: 'Roboto', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Consolas', 'Menlo', 'Courier New', monospace;
  --gradient-1: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
  --gradient-2: linear-gradient(135deg, #262626 0%, #0a0a0a 100%);
  --gradient-3: linear-gradient(135deg, #3f3f3f 0%, #111111 100%);
  --gradient-4: linear-gradient(135deg, #f97316 0%, #7c2d12 100%);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--dark);
  color: var(--text);
  overflow-x: hidden;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0a0a 0%, #171717 55%, #3f3f3f 100%);
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.12) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: backgroundMove 20s linear infinite;
}

@keyframes backgroundMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

.auth-container {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 40px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 60px var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s ease;
}

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

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header i {
  font-size: 48px;
  color: #fff;
  margin-bottom: 15px;
  display: block;
}

.auth-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.auth-header p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
  font-weight: 600;
}

.auth-tab:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.auth-tab.active {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 16px;
}

.input-group input {
  width: 100%;
  padding: 14px 15px 14px 45px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  transition: all 0.3s;
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.input-group input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
}

.select-input {
  width: 100%;
  padding: 14px 15px 14px 45px;
  background: var(--dark-lighter);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  transition: all 0.3s;
}

.select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.select-input option {
  background-color: var(--dark-light);
  color: var(--text);
  padding: 10px;
}

.select-input option:hover {
  background-color: var(--primary);
  color: #fff;
}

.auth-page .input-group input {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn i {
  font-size: 14px;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(249, 115, 22, 0.3);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--dark-lighter);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.error-message {
  color: #fca5a5;
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
  min-height: 20px;
}

.navbar {
  background: var(--dark-light);
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.navbar-brand i {
  color: var(--primary);
  font-size: 24px;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 20px;
}

.navbar-user span {
  color: var(--text-secondary);
  font-size: 14px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
}

.servers-section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.section-header h2 {
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-header h2 i {
  color: var(--primary);
}

.servers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  animation: fadeIn 0.5s ease;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 10px;
}

.empty-state-hint {
  font-size: 14px;
  opacity: 0.7;
}

.category-list-section {
  border-bottom: 1px solid var(--border);
}

.category-list-section:last-child {
  border-bottom: none;
}

.category-list-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  background: var(--dark-light);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s;
  user-select: none;
}

.category-list-header:hover {
  background: var(--dark-lighter);
}

.category-list-header i:first-child {
  font-size: 14px;
  color: var(--text-secondary);
  transition: transform 0.3s;
  width: 16px;
}

.category-list-section.collapsed .category-list-header i:first-child {
  transform: rotate(-90deg);
}

.category-list-header i:nth-child(2) {
  font-size: 18px;
  color: var(--primary);
  width: 24px;
  text-align: center;
}

.category-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.category-list-header .category-count {
  background: var(--dark-lighter);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.category-list-items {
  display: flex;
  flex-direction: column;
  max-height: 999px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.category-list-section.collapsed .category-list-items {
  max-height: 0;
}

.server-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(163, 163, 163, 0.15);
  transition: all 0.2s;
}

.server-list-item:last-child {
  border-bottom: none;
}

.server-list-item:hover {
  background: rgba(249, 115, 22, 0.06);
}

.server-list-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  cursor: pointer;
}

.server-list-info i {
  color: var(--primary);
  font-size: 16px;
  width: 24px;
  text-align: center;
}

.server-list-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.server-list-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.server-list-address {
  font-size: 12px;
  color: var(--text-secondary);
}

.server-list-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-icon-small {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  font-size: 14px;
}

.btn-icon-small:hover {
  background: var(--dark-lighter);
  color: var(--text);
}

.btn-icon-small.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.terminal-section {
  animation: slideUp 0.5s ease;
}

.terminal-card {
  background: var(--dark-light);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px var(--shadow);
}

.terminal-header {
  background: var(--dark-lighter);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.terminal-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  font-size: 10px;
  color: var(--text-secondary);
  animation: pulse 2s infinite;
}

.status-indicator.connected {
  color: var(--success);
}

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

#terminal {
  padding: 20px;
  height: 500px;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: var(--dark-light);
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px var(--shadow);
  animation: slideUp 0.3s ease;
}

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

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h2 i {
  color: var(--primary);
}

.close {
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.3s;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.close:hover {
  color: var(--text);
  background: var(--dark-lighter);
}

.modal-body {
  padding: 24px;
}

.server-info {
  background: var(--dark-lighter);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.info-row:last-child {
  margin-bottom: 0;
}

.info-row i {
  width: 24px;
  text-align: center;
  color: var(--primary);
  font-size: 16px;
}

.info-row div {
  flex: 1;
}

.info-row label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.info-row span {
  display: block;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

@media (max-width: 768px) {
  .navbar {
    padding: 16px 20px;
  }

  .navbar-brand {
    font-size: 18px;
  }

  .container {
    padding: 20px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

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

  #terminal {
    height: 400px;
  }
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: var(--dark);
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--dark-lighter);
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

.header-actions {
  display: flex;
  gap: 12px;
}

.btn-secondary {
  background: var(--dark-lighter);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.import-info {
  background: var(--dark-light);
  border-left: 4px solid var(--primary);
  padding: 16px;
  margin-bottom: 24px;
  border-radius: 8px;
}

.import-info i {
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 20px;
}

.import-info p {
  margin: 8px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.import-note {
  color: var(--warning) !important;
  font-size: 13px !important;
}

.file-input-wrapper {
  margin-bottom: 20px;
}

.selected-file {
  margin-top: 12px;
  padding: 12px;
  background: var(--dark-light);
  border-radius: 8px;
  color: var(--success);
  font-size: 14px;
  display: none;
}

.selected-file.active {
  display: block;
}

.selected-file i {
  margin-right: 8px;
}

.import-result {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  display: none;
}

.import-result.active {
  display: block;
}

.import-result.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}

.import-result.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.import-result i {
  margin-right: 8px;
}

.import-result p {
  margin: 8px 0;
}

.import-stats {
  margin-top: 12px;
  display: flex;
  gap: 16px;
  font-size: 14px;
}

.import-stat {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== MODERN UI ===== */

body {
  font-family: var(--font-main);
  font-size: 16px;
}

.input-group input,
.auth-page .input-group input {
  background: var(--dark);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 15px;
}

.input-group input::placeholder {
  color: var(--text-secondary);
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.select-input {
  background: var(--dark-lighter);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 15px;
}

.select-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.btn {
  font-family: var(--font-main);
  font-weight: 500;
}

.btn-primary {
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.terminal-card .category-name,
.terminal-card .category-count,
.terminal-card .server-list-name,
.terminal-card .server-list-address {
  font-family: var(--font-main);
}

.xterm {
  font-family: var(--font-mono);
  font-size: 14px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--dark-lighter);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ===== Search ===== */

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  pointer-events: none;
}

.search-box input {
  width: 220px;
  padding: 10px 14px 10px 38px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-main);
  transition: all 0.3s;
}

.search-box input::placeholder {
  color: var(--text-secondary);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

/* ===== Server status dots ===== */

.server-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
}

.server-status-dot.checking {
  background: var(--border);
  animation: pulse 1.5s infinite;
}

.server-status-dot.online {
  background: var(--warning);
}

.server-status-dot.ssh {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.server-status-dot.offline {
  background: var(--danger);
}

/* ===== Auth type toggle ===== */

.auth-type-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.auth-type-btn {
  flex: 1;
  padding: 10px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s;
}

.auth-type-btn:hover {
  border-color: var(--primary-light);
  color: var(--text);
}

.auth-type-btn.active {
  background: rgba(249, 115, 22, 0.15);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* ===== Textarea ===== */

.textarea-input {
  width: 100%;
  padding: 14px 15px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  resize: vertical;
  min-height: 100px;
  transition: all 0.3s;
}

.textarea-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.textarea-input[readonly] {
  color: var(--text-secondary);
}

/* ===== Modal sizes ===== */

.modal-content.modal-lg {
  max-width: 680px;
}

.modal-content.modal-sm {
  max-width: 420px;
}

/* ===== Toast notifications ===== */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  padding: 14px 18px;
  background: var(--dark-lighter);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-secondary);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-main);
  box-shadow: 0 10px 30px var(--shadow);
  opacity: 0;
  transform: translateX(120%);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast i {
  font-size: 16px;
  flex-shrink: 0;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-success i {
  color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error i {
  color: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-warning i {
  color: var(--warning);
}

.toast-info {
  border-left-color: var(--primary);
}

.toast-info i {
  color: var(--primary);
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
  .header-actions {
    flex-wrap: wrap;
  }

  .search-box input {
    width: 100%;
  }
}

