:root {
  --bg-color: #0b0f19;
  --sidebar-bg: #111827;
  --card-bg: #1f2937;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #10b981;
  --danger: #ef4444;
  --info: #3b82f6;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --border: #374151;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
}

.app-layout {
  display: flex;
  min-height: 100vh;
  transition: all 0.3s ease;
}

/* Hamburger Button */
.hamburger-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 1.4rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
}

.margin-right-10 {
  margin-right: 12px;
}

/* Sidebar Navigation */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  position: fixed;
  height: 100vh;
  top: 0;
  left: 0;
  z-index: 100;
  transition: width 0.3s ease, padding 0.3s ease;
}

/* Collapsed Sidebar Mode */
.app-layout.sidebar-collapsed .sidebar {
  width: 70px;
  padding: 20px 10px;
}

.app-layout.sidebar-collapsed .sidebar .brand-text,
.app-layout.sidebar-collapsed .sidebar .nav-text {
  display: none;
}

.app-layout.sidebar-collapsed .sidebar .nav-tab {
  justify-content: center;
  padding: 12px;
}

.app-layout.sidebar-collapsed .main-wrapper {
  margin-left: 70px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.brand-text h2 {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-vps {
  font-size: 0.7rem;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
  flex-grow: 1;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.menu-icon {
  font-size: 1.2rem;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 15px;
}

.server-indicator {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Main Content Area */
.main-wrapper {
  margin-left: 260px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.nav-left {
  display: flex;
  align-items: center;
}

.nav-left h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.domain-chip {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--success);
  color: #34d399;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.main-content {
  padding: 25px 30px;
  flex-grow: 1;
}

/* Tab Panes */
.tab-pane {
  display: none;
  animation: fadeInTab 0.3s ease-out;
}

.tab-pane.active {
  display: block;
}

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
}

/* Service Control Items with iOS Toggle Switches */
.services-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s ease;
}

.service-item.locked {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.05);
}

.service-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.service-icon {
  font-size: 1.8rem;
}

.service-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-protected {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.service-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.toggle-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-label {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 90px;
}

.text-success { color: #34d399; }
.text-danger { color: #f87171; }

/* Toggle Switch Styling */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #374151;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--success);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--success);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.switch.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result-card {
  border: 2px solid var(--success);
  background: rgba(16, 185, 129, 0.05);
}

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

.result-body-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 20px;
  align-items: center;
}

@media (max-width: 650px) {
  .result-body-grid {
    grid-template-columns: 1fr;
  }
}

.result-info p {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.result-info code {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 4px;
  color: #34d399;
  font-family: monospace;
}

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  padding: 10px;
  border-radius: 10px;
}

.qr-container img {
  width: 140px;
  height: 140px;
}

.qr-label {
  color: #000;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 5px;
}

.table-header-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-container {
  overflow-x: auto;
}

.account-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.account-table th, .account-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.account-table th {
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.account-table td {
  font-size: 0.9rem;
}

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
}

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

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

.proto-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* Modal Popup Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--primary);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.modal-header h3 {
  font-size: 1.15rem;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--danger);
}

.modal-body {
  padding: 20px;
}

.modal-user-summary {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.modal-section {
  padding: 15px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}

.border-tls {
  border: 1px solid var(--primary);
}

.border-ntls {
  border: 1px solid var(--info);
}

.modal-section h4 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.modal-flex-grid {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 15px;
  align-items: center;
}

@media (max-width: 550px) {
  .modal-flex-grid {
    grid-template-columns: 1fr;
  }
}

.modal-link-area input {
  width: 100%;
  font-size: 0.85rem;
}

.modal-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  padding: 8px;
  border-radius: 8px;
}

.modal-qr-box img {
  width: 120px;
  height: 120px;
}

.modal-qr-box span {
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 4px;
}

.card h2 {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.vps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
}

.vps-item {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
}

.vps-item:hover {
  border-color: var(--primary);
}

.vps-item.active {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.vps-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.vps-ip {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.account-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.input-inline, .terminal-input-bar {
  display: flex;
  gap: 10px;
}

input[type="text"], input[type="number"], .input-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 0.95rem;
}

.input-select option {
  background: var(--card-bg);
  color: var(--text-main);
}

.btn {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-info { background: var(--info); color: white; }
.btn-success { background: var(--success); color: white; }

.button-group {
  display: flex;
  gap: 10px;
}

.margin-top-10 { margin-top: 10px; }
.margin-top-15 { margin-top: 15px; }
.margin-top-20 { margin-top: 20px; }

.console-box, .console-mini {
  background: #000;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.console-header {
  background: #111;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-clear {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-clear:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

pre {
  padding: 14px;
  font-family: monospace;
  font-size: 0.9rem;
  color: #34d399;
  min-height: 180px;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.main-footer {
  padding: 20px 30px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
