/* Enterprise S3 Console Theme */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-surface: #1e293b;
  --bg-surface-hover: #334155;
  --border-color: #334155;
  --border-focus: #38bdf8;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --accent-cyan: #38bdf8;
  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --error-bg: #450a0a;
  --error-border: #991b1b;
  --error-text: #fecaca;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 20px 45px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
}

/* Background grid & subtle glow for enterprise tech feel */
.bg-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.bg-ambient-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, rgba(37, 99, 235, 0.03) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Top Navigation Bar */
.top-nav {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 34px;
  height: 34px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-version {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 7px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 9999px;
  letter-spacing: normal;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.cluster-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  background: rgba(30, 41, 59, 0.6);
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success-color);
  box-shadow: 0 0 8px var(--success-color);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.nav-link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

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

/* Main Container */
.main-wrapper {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.25rem;
  position: relative;
  overflow: hidden;
}

.card-header {
  margin-bottom: 1.75rem;
  text-align: left;
}

.card-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Endpoint Selector tabs */
.endpoint-selector {
  display: flex;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 1.5rem;
}

.endpoint-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.775rem;
  font-weight: 500;
  padding: 6px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.endpoint-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 500;
  color: #cbd5e1;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-subtle);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  background: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem 0.65rem 2.5rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.form-input.code-font {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.825rem;
  letter-spacing: 0.04em;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
  background: rgba(15, 23, 42, 0.95);
}

.form-input::placeholder {
  color: #475569;
}

.toggle-password {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 4px;
}

.toggle-password:hover {
  color: var(--text-main);
}

/* Accordion: Advanced Parameters */
.accordion {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 1.25rem;
  padding-top: 1rem;
  margin-bottom: 1.5rem;
}

.accordion-trigger {
  width: 100%;
  background: none;
  border: none;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
}

.accordion-chevron {
  transition: transform 0.2s ease;
}

.accordion-trigger.expanded .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  margin-top: 1rem;
  flex-direction: column;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(11, 15, 25, 0.4);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
}

.accordion-content.show {
  display: flex;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-row input {
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* Submit Button */
.btn-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--accent-blue), #1e40af);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.15s ease;
  position: relative;
}

.btn-submit:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Spinner */
.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Error Banner (Simulated AWS/S3 Error) */
.alert-box {
  display: none;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 1.25rem;
  font-size: 0.825rem;
  color: var(--error-text);
  animation: fadeIn 0.25s ease-in-out;
}

.alert-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: #fca5a5;
}

.alert-meta {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(239, 68, 68, 0.2);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.725rem;
  color: #f87171;
  word-break: break-all;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Compliance Security Notice */
.security-notice {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.725rem;
  color: var(--text-subtle);
  line-height: 1.45;
}

.security-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: #64748b;
}

/* Footer */
.portal-footer {
  position: relative;
  z-index: 10;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.775rem;
  color: var(--text-subtle);
  background: rgba(11, 15, 25, 0.9);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  color: var(--text-subtle);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--text-muted);
}

/* Documentation Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-window {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  padding: 1.75rem;
}

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.75rem;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.code-snippet {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.8rem;
  color: #38bdf8;
  margin: 0.75rem 0;
  overflow-x: auto;
  position: relative;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .top-nav {
    padding: 0.75rem 1rem;
  }
  .cluster-status {
    display: none;
  }
  .auth-card {
    padding: 1.5rem;
  }
  .portal-footer {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    padding: 1.25rem 1rem;
  }
}
