/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: linear-gradient(rgba(92, 148, 87, 0.85), rgba(52, 73, 94, 0.95)), url('../images/stardew-background.jpg') center/cover fixed;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Header */
header {
  background: linear-gradient(rgba(44, 62, 80, 0.95), rgba(44, 62, 80, 0.98)), url('../images/stardew-header.jpg') center/cover;
  color: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(139, 195, 74, 0.3);
}

header h1 {
  margin-bottom: 15px;
  font-size: 1.8em;
}

nav {
  display: flex;
  gap: 15px;
}

nav a {
  color: #ecf0f1;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

nav a:hover {
  background-color: #34495e;
}

nav a.active {
  background-color: #3498db;
}

/* Main content */
main {
  background-color: rgba(255, 255, 255, 0.97);
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  margin-bottom: 20px;
  backdrop-filter: blur(5px);
}

/* Sections */
.connection-section,
.controls-section,
.output-section,
.settings-section,
.error-section {
  margin-bottom: 30px;
}

/* Connection Section */
.connection-section {
  background: linear-gradient(135deg, rgba(139, 195, 74, 0.1) 0%, rgba(76, 175, 80, 0.15) 100%);
  border: 2px solid rgba(139, 195, 74, 0.4);
  border-radius: 8px;
  padding: 25px;
}

.connection-steps ol {
  margin: 15px 0;
  padding-left: 25px;
  line-height: 1.8;
}

.connection-steps ol li {
  margin-bottom: 8px;
}

.server-address-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.server-address {
  background-color: #1e1e1e;
  color: #8bc34a;
  padding: 12px 20px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  min-width: 250px;
  border: 2px solid rgba(139, 195, 74, 0.3);
  user-select: all;
}

.btn-copy {
  background-color: #8bc34a;
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-copy:hover:not(:disabled) {
  background-color: #7cb342;
}

.btn-copy.copied {
  background-color: #4caf50;
}

.connection-note {
  color: #5c6e7a;
  font-size: 14px;
  font-style: italic;
  margin-top: 10px;
}

.connection-section h2,
.controls-section h2,
.output-section h2,
.settings-section h2,
.error-section h2 {
  margin-bottom: 15px;
  color: #2c3e50;
}

/* Button grid */
.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

/* Control rows */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  margin-bottom: 15px;
  background-color: rgba(236, 240, 241, 0.5);
  border-radius: 8px;
  border: 1px solid rgba(189, 195, 199, 0.3);
}

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

.control-row h2 {
  margin: 0;
  font-size: 1.2em;
  color: #2c3e50;
  min-width: 150px;
}

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

.button-group .btn {
  min-width: 140px;
}

/* Toggle switches */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-label {
  font-size: 14px;
  color: #7f8c8d;
  font-weight: 500;
  min-width: 70px;
  text-align: center;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
}

.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: #95a5a6;
  transition: 0.4s;
  border-radius: 30px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #2ecc71;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(30px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* VNC controls */
.vnc-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.vnc-controls .warning-text {
  margin: 0;
  font-size: 13px;
  text-align: right;
}

.vnc-controls .toggle-group {
  margin-top: 5px;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: #3498db;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: #2980b9;
}

.btn-secondary {
  background-color: #95a5a6;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #7f8c8d;
}

.btn-success {
  background-color: #2ecc71;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background-color: #27ae60;
}

.btn-warning {
  background-color: #f39c12;
  color: white;
}

.btn-warning:hover:not(:disabled) {
  background-color: #e67e22;
}

.btn-vnc {
  background-color: #9b59b6;
  color: white;
}

.btn-vnc:hover:not(:disabled) {
  background-color: #8e44ad;
}

/* Operation status banner */
.operation-status {
  background-color: #3498db;
  color: white;
  padding: 15px 20px;
  border-radius: 6px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Output display */
.output-display {
  background-color: #1e1e1e;
  color: #d4d4d4;
  padding: 20px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.4;
  max-height: 600px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Login page */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  width: 100%;
  max-width: 450px;
  padding: 20px;
}

.login-card {
  background-color: white;
  padding: 50px 40px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.login-card h1 {
  font-size: 1.8em;
  color: #2c3e50;
  margin-bottom: 10px;
}

.login-subtitle {
  color: #7f8c8d;
  margin-bottom: 30px;
  font-size: 1em;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.login-card input[type="password"] {
  padding: 14px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 16px;
  width: 100%;
  transition: border-color 0.3s;
}

.login-card input[type="password"]:focus {
  outline: none;
  border-color: #667eea;
}

.login-card .btn {
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
}

.login-card .error {
  margin-top: 5px;
}

/* Settings page password inputs */
.settings-group input[type="password"] {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  width: 100%;
}

/* Settings page */
.settings-group {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #ecf0f1;
}

.settings-group:last-child {
  border-bottom: none;
}

.settings-group h3 {
  margin-bottom: 10px;
  color: #2c3e50;
}

.settings-group p {
  margin-bottom: 10px;
  color: #7f8c8d;
}

.settings-group form {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.settings-group input[type="password"] {
  flex: 1;
}

/* Messages */
.error {
  color: #e74c3c;
  padding: 10px;
  background-color: #fadbd8;
  border-radius: 4px;
  margin-top: 10px;
}

.message {
  padding: 10px;
  border-radius: 4px;
  margin-top: 10px;
}

.message.success {
  background-color: #d4edda;
  color: #155724;
}

.message.error {
  background-color: #f8d7da;
  color: #721c24;
}

.info-text {
  font-size: 14px;
  color: #7f8c8d;
}

.warning-text {
  color: #e67e22;
  font-weight: 500;
  margin-bottom: 15px;
}

/* Error page */
.error-section {
  text-align: center;
  padding: 60px 20px;
}

.error-section h2 {
  font-size: 2em;
  margin-bottom: 15px;
}

.error-section p {
  margin-bottom: 30px;
  color: #7f8c8d;
}

/* Footer */
footer {
  text-align: center;
  color: #ecf0f1;
  padding: 20px;
  font-size: 14px;
  background-color: rgba(44, 62, 80, 0.7);
  border-radius: 8px;
  backdrop-filter: blur(5px);
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  header h1 {
    font-size: 1.4em;
  }

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

  main {
    padding: 20px;
  }

  .login-card {
    padding: 40px 30px;
  }

  .login-card h1 {
    font-size: 1.5em;
  }

  .control-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
  }

  .control-row h2 {
    font-size: 1.1em;
    min-width: auto;
  }

  .button-group {
    width: 100%;
    flex-direction: column;
  }

  .button-group .btn {
    width: 100%;
  }

  .vnc-controls {
    width: 100%;
    align-items: flex-start;
  }

  .vnc-controls .warning-text {
    text-align: left;
  }

  .toggle-label {
    font-size: 13px;
    min-width: 60px;
  }
}

/* Status Indicators Section */
.status-indicators {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 15px;
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(155, 89, 182, 0.1) 100%);
  border: 2px solid rgba(52, 152, 219, 0.3);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.status-indicator:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.status-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.status-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.status-label {
  font-size: 11px;
  color: #7f8c8d;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.status-value {
  font-size: 14px;
  color: #2c3e50;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-value.status-good {
  color: #27ae60;
}

.status-value.status-warning {
  color: #f39c12;
}

.status-value.status-error {
  color: #e74c3c;
}

/* Responsive adjustments for status indicators */
@media (max-width: 768px) {
  .status-indicators {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .status-indicator {
    padding: 8px;
  }

  .status-icon {
    font-size: 20px;
  }

  .status-label {
    font-size: 10px;
  }

  .status-value {
    font-size: 13px;
  }
}
