/* CSS Custom Customizations - Premium Glassmorphic Theme */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Color Tokens */
  --bg-main: #070a13;
  --bg-card: rgba(19, 27, 46, 0.55);
  --bg-card-hover: rgba(26, 36, 61, 0.65);
  --border-glow: rgba(99, 102, 241, 0.15);
  --border-light: rgba(255, 255, 255, 0.08);
  
  --color-primary: #6366f1; /* Indigo */
  --color-primary-glow: rgba(99, 102, 241, 0.4);
  --color-secondary: #a855f7; /* Purple */
  --color-accent: #10b981; /* Emerald */
  --color-accent-glow: rgba(16, 185, 129, 0.3);
  --color-danger: #ef4444;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --shadow-neon: 0 8px 32px 0 rgba(0, 0, 0, 0.37), 0 0 15px 0 rgba(99, 102, 241, 0.1);
  --shadow-neon-hover: 0 8px 32px 0 rgba(0, 0, 0, 0.5), 0 0 25px 0 rgba(99, 102, 241, 0.25);
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Scrollbar */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Ambient glow backgrounds */
body::before, body::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  z-index: -1;
  filter: blur(120px);
  pointer-events: none;
  opacity: 0.15;
}

body::before {
  top: 10%;
  left: 10%;
  background: var(--color-primary);
}

body::after {
  bottom: 10%;
  right: 10%;
  background: var(--color-secondary);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(7, 10, 19, 0.3);
}
::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.6);
}

/* Utility Layouts */
.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Glassmorphism Styles */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  box-shadow: var(--shadow-neon);
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: var(--shadow-neon-hover);
}

/* Inputs & Form Elements */
.input-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.input-styled {
  background: rgba(7, 10, 19, 0.5);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.input-styled:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
  background: rgba(7, 10, 19, 0.7);
}

.input-styled::placeholder {
  color: var(--text-muted);
}

/* Auth Screens */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 85vh;
  width: 100%;
}

.auth-card {
  width: 100%;
  max-width: 450px;
  padding: 2.5rem;
  margin: 1rem;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.auth-logo i {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth-tabs {
  display: flex;
  background: rgba(7, 10, 19, 0.6);
  border-radius: 10px;
  padding: 0.3rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-light);
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.6rem 0;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition-smooth);
}

.auth-tab-btn.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border: none;
  border-radius: 12px;
  padding: 0.9rem;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  filter: brightness(1.1);
}

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

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 1.5rem 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-light);
}

.divider:not(:empty)::before {
  margin-right: .75em;
}

.divider:not(:empty)::after {
  margin-left: .75em;
}

.btn-google {
  width: 100%;
  background: #fff;
  color: #1f2937;
  border: none;
  border-radius: 12px;
  padding: 0.9rem;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.btn-google:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
  background: #f3f4f6;
}

.btn-google svg {
  width: 18px;
  height: 18px;
}

/* Dashboard Layout */
.dashboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  padding: 1rem 2rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.4rem;
  background: linear-gradient(135deg, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-section i {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.profile-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.user-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.btn-logout {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-logout:hover {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Dashboard Body */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.9fr;
  gap: 1.5rem;
  align-items: start;
}

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

/* Left panel: Creator */
.generator-card {
  padding: 2rem;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title i {
  color: var(--color-primary);
}

.customization-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(7, 10, 19, 0.5);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}

.color-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  background-color: transparent;
  border: none;
  cursor: pointer;
}

.color-picker::-webkit-color-swatch {
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.color-text {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Preview Area */
.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(7, 10, 19, 0.4);
  border-radius: 16px;
  border: 1px dashed var(--border-light);
  margin: 1.5rem 0;
  min-height: 250px;
  position: relative;
}

#qr-canvas-wrapper {
  background: transparent;
  padding: 10px;
  border-radius: 12px;
  display: none;
}

#qr-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.placeholder-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  text-align: center;
}

.placeholder-preview i {
  font-size: 3rem;
  animation: pulse-glow 2s infinite alternate;
}

.generator-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-secondary {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 0.9rem;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
}

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

/* History Card */
.history-card {
  padding: 2rem;
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-input-wrapper {
  position: relative;
  width: 250px;
}

.search-input-wrapper i {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-input-wrapper .input-styled {
  width: 100%;
  padding-left: 2.2rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.85rem;
  border-radius: 10px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  overflow-y: auto;
  max-height: 520px;
  padding-right: 0.5rem;
  flex-grow: 1;
}

.empty-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 350px;
  color: var(--text-muted);
  text-align: center;
  gap: 1rem;
}

.empty-history i {
  font-size: 3.5rem;
}

/* Saved Item Cards */
.saved-item {
  background: rgba(7, 10, 19, 0.4);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 290px;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.saved-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  opacity: 0;
  transition: var(--transition-smooth);
}

.saved-item:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.saved-item:hover::before {
  opacity: 1;
}

.saved-qr-display {
  display: flex;
  justify-content: center;
  align-items: center;
  background: white;
  width: 140px;
  height: 140px;
  margin: 0 auto 1rem;
  border-radius: 10px;
  padding: 6px;
}

.saved-qr-display canvas {
  width: 100% !important;
  height: auto !important;
}

.saved-info {
  margin-bottom: 1rem;
}

.saved-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-content {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.3rem;
}

.saved-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.saved-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-top: auto;
}

.btn-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition-smooth);
}

.btn-action:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn-action.btn-delete:hover {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

/* FireBase Config overlay alert */
.config-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 19, 0.85);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.config-card {
  max-width: 550px;
  width: 100%;
  padding: 2.5rem;
  text-align: center;
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.15);
}

.config-card i.error-icon {
  font-size: 3.5rem;
  color: var(--color-danger);
  margin-bottom: 1.5rem;
  animation: pulse-danger 2s infinite alternate;
}

.config-card h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.config-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.config-steps {
  text-align: left;
  background: rgba(7, 10, 19, 0.5);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.config-steps ol {
  padding-left: 1.2rem;
}

.config-steps li {
  margin-bottom: 0.6rem;
}

.config-steps code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-family: monospace;
  color: #fff;
}

/* Toast System */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: rgba(19, 27, 46, 0.9);
  backdrop-filter: blur(8px);
  border-left: 4px solid var(--color-primary);
  border-top: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  min-width: 280px;
  animation: slide-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: var(--transition-smooth);
}

.toast.success {
  border-left-color: var(--color-accent);
}

.toast.success i {
  color: var(--color-accent);
}

.toast.error {
  border-left-color: var(--color-danger);
}

.toast.error i {
  color: var(--color-danger);
}

.toast.info i {
  color: var(--color-primary);
}

/* Animations */
@keyframes pulse-glow {
  0% {
    filter: drop-shadow(0 0 2px rgba(99, 102, 241, 0.2));
    opacity: 0.6;
  }
  100% {
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.7));
    opacity: 1;
  }
}

@keyframes pulse-danger {
  0% {
    filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.2));
  }
  100% {
    filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.6));
  }
}

@keyframes slide-in {
  0% {
    transform: translateX(120%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Spinner */
.spinner {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* View states toggle utility */
.view-state {
  display: none;
}

.view-state.active {
  display: block;
}

.d-none {
  display: none !important;
}
