/* WebSSH Client Styles */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: #0b0f14;
  color: #fff;
  font-family: 'Segoe UI', system-ui, sans-serif;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 280px;
  background: #111827;
  border-right: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 15px;
  background: #1f2937;
  border-bottom: 1px solid #374151;
}

.sidebar-header h2 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #f3f4f6;
}

.btn-add {
  width: 100%;
  padding: 8px;
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.btn-add:hover { background: #059669; }

.connection-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.connection-item {
  padding: 12px;
  margin-bottom: 8px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.connection-item:hover {
  background: #374151;
  border-color: #4b5563;
}

.connection-item.active {
  background: #064e3b;
  border-color: #10b981;
}

.connection-item.connected { border-left: 3px solid #10b981; }
.connection-item.disconnected { border-left: 3px solid #ef4444; }

.connection-name {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-info {
  font-size: 12px;
  color: #9ca3af;
}

.connection-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

.status-dot.connected { background: #10b981; }
.status-dot.disconnected { background: #ef4444; }

.connection-actions {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.btn-small {
  padding: 4px 8px;
  font-size: 11px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.btn-connect { background: #10b981; color: #fff; }
.btn-disconnect { background: #ef4444; color: #fff; }
.btn-delete { background: #374151; color: #9ca3af; }

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.toolbar {
  padding: 10px 15px;
  background: #111827;
  border-bottom: 1px solid #1f2937;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar-group {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 8px;
  border-right: 1px solid #374151;
}

.toolbar-group:last-child { border-right: none; }

input, select, textarea {
  background: #1f2937;
  border: 1px solid #374151;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #10b981;
}

input[type="password"] { font-family: monospace; }

button {
  background: #10b981;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  color: #fff;
  font-size: 13px;
}

button:hover { background: #059669; }
button:disabled {
  background: #374151;
  cursor: not-allowed;
}

.btn-secondary { background: #374151; }
.btn-secondary:hover { background: #4b5563; }
.btn-secondary.active {
  background: #10b981;
  color: white;
}
.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #dc2626; }

.btn-icon {
  background: #374151;
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
}

.btn-icon:hover { background: #4b5563; }
.btn-icon.active { background: #10b981; }

.details-row {
  padding: 10px 15px;
  background: #0f172a;
  border-bottom: 1px solid #1f2937;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.key-input-row {
  display: none;
  width: 100%;
  margin-top: 10px;
}

.key-input-row.active {
  display: flex;
  gap: 10px;
}

textarea#sshKey {
  flex: 1;
  min-height: 50px;
  resize: vertical;
  font-family: monospace;
  font-size: 12px;
}

.terminal-container {
  flex: 1;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: #1f2937;
  border-radius: 8px 8px 0 0;
  border: 1px solid #374151;
  border-bottom: none;
}

.terminal-title {
  font-size: 14px;
  font-weight: 500;
}

.terminal-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  background: #374151;
}

.terminal-status.connected {
  background: #064e3b;
  color: #10b981;
}

.terminal-status.disconnected {
  background: #450a0a;
  color: #ef4444;
}

#terminal {
  flex: 1;
  background: #0b0f14;
  border: 1px solid #374151;
  border-radius: 0 0 8px 8px;
  padding: 5px;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: #1f2937;
  border-radius: 12px;
  padding: 25px;
  width: 700px;
  max-width: 95vw;
  border: 1px solid #374151;
}

.modal h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
}

.form-group { margin-bottom: 15px; }

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  color: #9ca3af;
}

.form-group input,
.form-group select,
.form-group textarea { width: 100%; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.hidden { display: none !important; }

/* SFTP Main Container - Integrated View */
.sftp-container-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: #1f2937;
  overflow: hidden;
  min-height: 0;
}

/* SFTP FileZilla Style File Manager */
.filezilla-style {
  width: 95vw;
  max-width: 1400px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.filezilla-style .sftp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: white;
  border-bottom: 2px solid #1e3a8a;
}

.filezilla-style .sftp-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

/* Quick Connect Bar */
.sftp-quick-connect {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 15px;
  background: #1f2937;
  border-bottom: 1px solid #374151;
  gap: 10px;
}

.sftp-connect-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #9ca3af;
}

.sftp-connect-field label {
  font-weight: 600;
  color: #e5e7eb;
}

.sftp-connect-buttons {
  display: flex;
  gap: 6px;
}

/* Dual Pane Layout */
.sftp-dual-pane {
  display: flex;
  flex: 1;
  gap: 2px;
  background: #111827;
  overflow: hidden;
}

/* Panels */
.sftp-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #1f2937;
  min-width: 0;
}

.sftp-panel-header {
  background: #374151;
  padding: 8px 12px;
  border-bottom: 2px solid #4b5563;
}

.sftp-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sftp-panel-path {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sftp-panel-path input {
  flex: 1;
  background: #111827;
  border: 1px solid #4b5563;
  border-radius: 3px;
  padding: 4px 8px;
  font-family: monospace;
  font-size: 12px;
  color: #e5e7eb;
  min-width: 0;
}

.sftp-panel-path input[readonly] {
  background: #1f2937;
  color: #9ca3af;
}

.sftp-nav-btn {
  background: #4b5563;
  border: none;
  border-radius: 3px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
  white-space: nowrap;
  color: #e5e7eb;
}

.sftp-nav-btn:hover {
  background: #6b7280;
}

/* File Lists */
.sftp-file-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #111827;
}

.sftp-file-list .sftp-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6b7280;
  font-size: 13px;
  font-style: italic;
}

/* File Item - FileZilla style row */
.sftp-file-item {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #1f2937;
  transition: background 0.15s;
}

.sftp-file-item:hover {
  background: #2563eb;
}

.sftp-file-item.selected {
  background: #1d4ed8;
}

.sftp-file-item .icon {
  width: 24px;
  text-align: center;
  margin-right: 8px;
}

.sftp-file-item .name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e5e7eb;
}

.sftp-file-item .size {
  width: 80px;
  text-align: right;
  color: #9ca3af;
  font-size: 12px;
}

.sftp-file-item .date {
  width: 140px;
  text-align: right;
  color: #9ca3af;
  font-size: 12px;
}

/* Column Headers */
.sftp-column-headers {
  display: flex;
  padding: 6px 10px;
  background: #374151;
  border-bottom: 1px solid #4b5563;
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
}

.sftp-column-headers .col-name { flex: 1; }
.sftp-column-headers .col-size { width: 80px; text-align: right; }
.sftp-column-headers .col-date { width: 140px; text-align: right; }

/* Transfer Arrows */
.sftp-transfer-arrows {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding: 10px;
  background: #1f2937;
  min-width: 50px;
}

.sftp-arrow-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sftp-arrow-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: scale(1.1);
}

.sftp-arrow-btn:active {
  transform: scale(0.95);
}

/* Transfer Queue - Bottom Section */
.sftp-queue-section {
  height: 180px;
  background: #1f2937;
  border-top: 2px solid #374151;
  display: flex;
  flex-direction: column;
}

.sftp-queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 15px;
  background: #374151;
  border-bottom: 1px solid #4b5563;
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
}

.sftp-queue-list {
  flex: 1;
  overflow-y: auto;
  padding: 5px;
}

.sftp-queue-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6b7280;
  font-size: 13px;
  font-style: italic;
}

.sftp-queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: #111827;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 12px;
}

.sftp-queue-item .queue-icon {
  width: 20px;
  text-align: center;
}

.sftp-queue-item .queue-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e5e7eb;
}

.sftp-queue-item .queue-progress {
  width: 150px;
  height: 6px;
  background: #374151;
  border-radius: 3px;
  overflow: hidden;
}

.sftp-queue-item .queue-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 3px;
  transition: width 0.3s;
}

.sftp-queue-item .queue-status {
  width: 80px;
  text-align: right;
  color: #9ca3af;
}

.sftp-queue-item .queue-speed {
  width: 100px;
  text-align: right;
  color: #10b981;
}

.sftp-queue-item.completed .queue-status {
  color: #10b981;
}

.sftp-queue-item.error .queue-status {
  color: #ef4444;
}

/* Drag and Drop States */
.sftp-file-list.drag-over {
  background: rgba(59, 130, 246, 0.1);
  border: 2px dashed #3b82f6;
}

/* Scrollbar Styling */
.sftp-file-list::-webkit-scrollbar,
.sftp-queue-list::-webkit-scrollbar {
  width: 8px;
}

.sftp-file-list::-webkit-scrollbar-track,
.sftp-queue-list::-webkit-scrollbar-track {
  background: #111827;
}

.sftp-file-list::-webkit-scrollbar-thumb,
.sftp-queue-list::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 4px;
}

.sftp-file-list::-webkit-scrollbar-thumb:hover,
.sftp-queue-list::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Legacy styles - kept for compatibility */
.sftp-modal {
  width: 900px;
  max-width: 95vw;
  height: 80vh;
  display: flex;
  flex-direction: column;
}

.sftp-toolbar {
  display: flex;
  gap: 8px;
}

.sftp-path-bar {
  padding: 10px 20px;
  background: #111827;
  border-bottom: 1px solid #374151;
  font-family: monospace;
  font-size: 13px;
  color: #9ca3af;
}

.sftp-container {
  display: flex;
  flex: 1;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
}

.sftp-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  overflow: hidden;
}

.sftp-pane-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 15px;
  background: #1f2937;
  border-bottom: 1px solid #374151;
  font-size: 13px;
  font-weight: 500;
  color: #e5e7eb;
}

.sftp-upload-area {
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sftp-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  border: 2px dashed #4b5563;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
}

.sftp-drop-zone:hover,
.sftp-drop-zone.drag-over {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  color: #e5e7eb;
}

.sftp-drop-icon {
  font-size: 32px;
}

.sftp-drop-hint {
  font-size: 11px;
  color: #6b7280;
}

.sftp-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6b7280;
  font-size: 13px;
}

.sftp-progress-area {
  max-height: 150px;
  overflow-y: auto;
  border-top: 1px solid #374151;
  background: #111827;
  padding: 10px;
}

.sftp-progress-item {
  margin-bottom: 10px;
  padding: 10px;
  background: #1f2937;
  border-radius: 6px;
}

.sftp-progress-file {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

.sftp-progress-name {
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.sftp-progress-size {
  color: #9ca3af;
  font-size: 12px;
}

.sftp-progress-bar {
  height: 6px;
  background: #374151;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.sftp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.sftp-progress-status {
  font-size: 11px;
  color: #9ca3af;
}

/* Help Modal Styles */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #374151;
  background: #1f2937;
}

.modal-header h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}
