/* Base resets and variables */
:root {
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --bg-primary: #07090e;
  --card-bg: rgba(13, 20, 35, 0.55);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-glow: rgba(99, 102, 241, 0.12);
  
  --color-text: #f3f4f6;
  --color-text-muted: #9ca3af;
  
  --primary: #6366f1; /* Indigo */
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);
  
  --success: #10b981; /* Emerald */
  --success-glow: rgba(16, 185, 129, 0.2);
  
  --danger: #ef4444; /* Red */
  --danger-glow: rgba(239, 68, 68, 0.2);
  
  --radius-lg: 16px;
  --radius-md: 10px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Ambient glow backgrounds */
.glow-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
}

.glow-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  animation: float 20s ease-in-out infinite alternate;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #8b5cf6 0%, rgba(0,0,0,0) 70%);
  top: -100px;
  right: -50px;
}

.glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #06b6d4 0%, rgba(0,0,0,0) 70%);
  bottom: -150px;
  left: -100px;
  animation-delay: -5s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 30px) scale(1.1); }
}

/* App Container */
.container {
  width: 100%;
  max-width: 520px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  z-index: 10;
}

/* Dashboard Wide Container */
.dashboard-container {
  max-width: 960px;
}

/* Header */
.header {
  text-align: center;
}

.logo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50px;
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 0.95rem;
  color: var(--primary);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.logo-icon {
  width: 18px;
  height: 18px;
  animation: pulse-slow 3s infinite;
}

@keyframes pulse-slow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.nav-link-btn {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: var(--primary-glow);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 14px;
  border-radius: 50px;
  transition: var(--transition);
}

.nav-link-btn:hover {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* User Menu inside Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 4px 6px 4px 14px;
  border-radius: 50px;
}

.user-email {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.btn-logout-small {
  width: 28px;
  height: 28px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout-small:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fff;
}

.logout-icon {
  width: 14px;
  height: 14px;
}

.title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 420px;
  margin: 0 auto;
}

/* Main Card */
.main-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 40px var(--card-glow);
  padding: 32px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.main-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #06b6d4, var(--primary));
  background-size: 200% auto;
  animation: shine 4s linear infinite;
}

@keyframes shine {
  to { background-position: 200% center; }
}

/* Add Key Card styling */
.add-key-card h3 {
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 4px;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.inline-form-row {
  display: flex;
  gap: 12px;
}

.inline-form-row .input-wrapper {
  flex-grow: 1;
}

.btn-inline {
  width: auto;
  padding: 0 24px;
  flex-shrink: 0;
}

/* Screen Transitions & Auth toggles */
.auth-section {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.auth-section.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.auth-toggle-text {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 20px;
}

.auth-toggle-text a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.auth-toggle-text a:hover {
  text-decoration: underline;
  color: #a5b4fc;
}

/* Form Styling */
.form-group {
  margin-bottom: 18px;
}

.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

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

.input-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
  transition: var(--transition);
}

.form-group input {
  width: 100%;
  padding: 14px 14px 14px 46px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.form-group input:focus + .input-icon {
  color: var(--primary);
}

.helper-text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 8px;
  line-height: 1.4;
}

/* Inline row input override */
.inline-form-row input {
  padding: 14px 14px 14px 46px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  width: 100%;
}
.inline-form-row input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 15px 20px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--primary-glow);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon {
  width: 16px;
  height: 16px;
  transition: var(--transition);
}

.btn-primary:hover .btn-icon {
  transform: translateX(3px);
}

/* Error Box */
.error-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  color: #ef4444;
  font-size: 0.9rem;
  animation: shake 0.4s ease-in-out;
}

.error-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Success Box */
.success-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  color: var(--success);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Dynamic Claims Grid & Cabinet UI */
.claims-section {
  margin-top: 12px;
}

.section-title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
}

.claims-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 20px;
}

@media (max-width: 900px) {
  .claims-grid {
    grid-template-columns: 1fr;
  }
}

.claim-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

.claim-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.claim-card-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.claim-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.category-tag {
  align-self: flex-start;
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Credentials boxes */
.credentials-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cred-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cred-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
}

.cred-value-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 2px 2px 2px 10px;
  transition: var(--transition);
}

.cred-value-box:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.cred-value-box input {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 0;
  outline: none;
  width: 100%;
}

.btn-icon-only {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon-only:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.eye-svg {
  width: 16px;
  height: 16px;
}

.btn-copy {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-text-muted);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.btn-copy:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.copy-svg {
  width: 16px;
  height: 16px;
}

/* Copy Tooltip */
.btn-copy .tooltip {
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: var(--success);
  color: #fff;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.btn-copy .tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -4px;
  border-width: 4px;
  border-style: solid;
  border-color: var(--success) transparent transparent transparent;
}

.btn-copy.copied .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Alert Box */
.info-alert {
  display: flex;
  gap: 10px;
  background: rgba(99, 102, 241, 0.04);
  border-left: 2px solid var(--primary);
  padding: 12px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.alert-icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
  flex-shrink: 0;
}

.alert-content strong {
  color: #fff;
  display: block;
  margin-bottom: 2px;
}

.alert-content p {
  color: var(--color-text-muted);
}

/* Instructions Box */
.instructions-box {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 12px;
}

.instructions-content {
  color: var(--color-text-muted);
  white-space: pre-wrap;
}

/* Empty State / Loading State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-icon {
  width: 40px;
  height: 40px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state p {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.empty-state span {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* Footer Section */
.footer {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  align-self: center;
  transition: var(--transition);
}

.contact-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.support-icon {
  width: 16px;
  height: 16px;
}

.copyright {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Loading state spinner */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

.loading span {
  visibility: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-top: -10px;
  margin-left: -10px;
  border: 2px solid transparent;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Responsive adjust */
@media (max-width: 480px) {
  .main-card {
    padding: 24px 16px;
  }
  .title {
    font-size: 1.8rem;
  }
}
