/* ============================================================================
   Login Modal & Authentication Styles
   ============================================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: linear-gradient(135deg, rgba(13, 31, 49, 0.98), rgba(9, 19, 32, 0.98));
  border: 2px solid rgba(0, 247, 255, 0.3);
  border-radius: var(--card-radius);
  padding: var(--spacing-xl);
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 80px rgba(0, 247, 255, 0.1);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.modal-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-color);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--spacing-sm);
  text-shadow: 0 0 20px rgba(0, 247, 255, 0.4);
}

.modal-header p {
  color: var(--muted-text);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

/* Login Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input {
  background: rgba(5, 14, 24, 0.6);
  border: 1px solid rgba(0, 247, 255, 0.2);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--text-color);
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: rgba(0, 247, 255, 0.6);
  box-shadow: 0 0 15px rgba(0, 247, 255, 0.2);
}

.form-group input::placeholder {
  color: var(--muted-text);
  opacity: 0.6;
}

.form-error {
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid rgba(255, 71, 87, 0.4);
  border-radius: 8px;
  padding: var(--spacing-sm) var(--spacing-md);
  color: #ff8a95;
  font-size: 0.85rem;
  display: none;
}

.btn-submit {
  background: linear-gradient(135deg, rgba(0, 247, 255, 0.2), rgba(0, 158, 196, 0.9));
  border: 1px solid rgba(0, 247, 255, 0.4);
  border-radius: 999px;
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-color);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0, 247, 255, 0.35);
}

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

.btn-submit::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s ease;
}

.btn-submit:hover::after {
  left: 120%;
}

.btn-loader {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Connection Status */
.header-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.5rem 1rem;
  background: rgba(5, 14, 24, 0.6);
  border: 1px solid rgba(255, 71, 87, 0.3);
  border-radius: 999px;
  transition: border-color 0.3s ease;
}

.connection-status.connected {
  border-color: rgba(46, 213, 115, 0.5);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4757;
  box-shadow: 0 0 10px rgba(255, 71, 87, 0.6);
  animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
  background: #2ed573;
  box-shadow: 0 0 10px rgba(46, 213, 115, 0.6);
}

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

.status-text {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-color);
}

.disconnect-button {
  background: linear-gradient(135deg, rgba(255, 71, 87, 0.3), rgba(196, 0, 0, 0.9));
  border: 1px solid rgba(255, 71, 87, 0.6);
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-color);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.disconnect-button::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s ease;
}

.disconnect-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(255, 71, 87, 0.4);
}

.disconnect-button:hover::after {
  left: 120%;
}

.hidden {
  display: none !important;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .modal-content {
    padding: var(--spacing-lg);
    max-width: 95%;
  }

  .modal-header h2 {
    font-size: 1.4rem;
  }

  .connection-status {
    padding: 0.4rem 0.75rem;
  }

  .status-text {
    font-size: 0.75rem;
  }

  .header-controls {
    flex-wrap: wrap;
    gap: var(--spacing-sm);
  }
}
