/* ==========================================================================
   QUOTE OF THE DAY - CLEAN MINIMALISM THEME (style.css)
   ========================================================================== */

/* 1. CSS VARIABLES & RESET */
:root {
  /* Fonts */
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-playfair: 'Playfair Display', Georgia, serif;
  --font-sans: 'Montserrat', system-ui, -apple-system, sans-serif;

  /* Colors */
  --color-bg-dark: #0a0a0a;
  --color-text-main: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.6);
  --color-accent: #ffffff;
  
  /* Glassmorphism & Borders */
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-hover: rgba(255, 255, 255, 0.3);
  --glass-blur: blur(12px);
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: var(--font-sans);
  background-color: var(--color-bg-dark);
  color: var(--color-text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}

/* 2. DYNAMIC BACKGROUND & AMBIENT BLUR OVERLAY */
.bg-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 1s ease-in-out, transform 10s ease-out;
}

.bg-image.loaded {
  opacity: 0.55;
  transform: scale(1);
}

/* Ambient glow blobs from Clean Minimalism design */
.bg-fallback {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
  z-index: -1;
}

.bg-fallback::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -10%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: #1a3a5a;
  filter: blur(120px);
  opacity: 0.5;
}

.bg-fallback::after {
  content: '';
  position: absolute;
  bottom: -5%;
  right: -5%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: #3a1a3a;
  filter: blur(100px);
  opacity: 0.4;
}

/* Dark Minimalist Overlay */
.bg-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(10, 10, 10, 0.4) 0%, rgba(10, 10, 10, 0.85) 100%);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* 3. HEADER & TOP BAR */
.app-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2.5rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.brand-sparkle {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.brand-bulb-icon {
  width: 18px;
  height: 18px;
  stroke: rgba(255, 255, 255, 0.9);
  fill: none;
}

.brand-title {
  color: rgba(255, 255, 255, 0.6);
}

/* Minimalist Language Switcher Pill */
.lang-selector {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 6px;
  border-radius: 9999px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  color: #ffffff;
}

.lang-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.lang-btn .flag {
  font-size: 0.9rem;
}

/* Header right side: favorites button + language switcher */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: all var(--transition-fast);
}

.header-icon-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

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

/* Search & favorites modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 1.5rem 1.5rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  background: rgba(18, 18, 18, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.9rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
}

.search-field-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.5);
}

.search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 1rem;
  -webkit-user-select: text;
  user-select: text;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.search-input::-webkit-search-cancel-button {
  display: none;
}

.search-section-label {
  padding: 0.8rem 1.25rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.modal-close,
.favorites-item-fav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 9999px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover,
.favorites-item-fav:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.favorites-item-fav.is-favorited {
  color: #f43f5e;
}

.favorites-item-fav.is-favorited .favorite-icon {
  fill: #f43f5e;
}

.favorites-empty {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.favorites-empty[hidden] {
  display: none;
}

.favorites-list {
  list-style: none;
  overflow-y: auto;
}

.favorites-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.favorites-item:last-child {
  border-bottom: none;
}

.favorites-item-open {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: background var(--transition-fast);
}

.favorites-item-open:hover {
  background: rgba(255, 255, 255, 0.05);
}

.favorites-item-text {
  font-family: var(--font-playfair);
  font-size: 1.05rem;
  line-height: 1.45;
  color: #ffffff;
}

.favorites-item-author {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* 4. MAIN LAYOUT & QUOTE DISPLAY */
.main-content {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 1.5rem 6rem 1.5rem;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.quote-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

/* Row holding the Quote Badge + Favorite Toggle side by side */
.quote-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

/* Quote Badge (Quote of the Day / Random Quote) */
.quote-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: all var(--transition-normal);
}

.badge-icon {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

/* Favorite Toggle (heart) */
.favorite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: all var(--transition-fast);
}

.favorite-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

.favorite-icon {
  width: 15px;
  height: 15px;
  transition: all var(--transition-fast);
}

.favorite-btn.is-favorited {
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.5);
}

.favorite-btn.is-favorited .favorite-icon {
  fill: #f43f5e;
}

/* Quote Content Box */
.quote-content {
  position: relative;
  width: 100%;
  max-width: 850px;
  margin-bottom: 2rem;
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

/* Allow manual selection/copy of the quote text and author, unlike the rest of the UI chrome */
.quote-text,
.quote-author {
  -webkit-user-select: text;
  user-select: text;
}

.quote-mark {
  font-family: var(--font-serif);
  font-size: 10rem;
  line-height: 0;
  color: rgba(255, 255, 255, 0.12);
  position: absolute;
  -webkit-user-select: none;
  user-select: none;
}

.quote-mark-start {
  top: 1rem;
  left: -1rem;
}

.quote-mark-end {
  bottom: -.5rem;
  right: -1rem;
}

/* Responsive Typography with clamp() - Playfair Display Regular */
.quote-text {
  font-family: var(--font-playfair);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw + 0.5rem, 3.5rem);
  line-height: 1.35;
  color: #ffffff;
  letter-spacing: -0.01em;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.8);
  word-wrap: break-word;
  text-transform: none;
  font-variant: normal;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Animation states for quotes transition */
.quote-text,
.quote-author {
  transition: opacity 0.25s ease, transform 0.25s ease;
  will-change: opacity, transform;
}

.quote-text.fade-out,
.quote-author.fade-out {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.22s ease-in, transform 0.22s ease-in;
}

.quote-text.fade-in,
.quote-author.fade-in {
  animation: quoteFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes quoteFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Playfair Display Regular Style for Quotes */
.font-style-playfair,
.font-style-serif {
  font-family: var(--font-playfair);
  font-style: normal;
  font-weight: 400;
  text-transform: none;
  font-variant: normal;
}

/* Author Name with Clean Minimalist Line Accents (Montserrat) */
.quote-author {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-family: var(--font-sans);
  font-size: clamp(0.85rem, 1.5vw + 0.2rem, 1.1rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 3.5rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.quote-author::before,
.quote-author::after {
  content: '';
  display: inline-block;
  width: 32px;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
}

#author-name {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  text-underline-offset: 6px;
}

#author-name:hover,
#author-name:focus-visible {
  text-decoration: underline;
  outline: none;
}

/* Export Format Selector (aspect ratio pill group, same pattern as .lang-selector) */
.format-selector {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 6px;
  border-radius: 9999px;
  margin-bottom: 0.6rem;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* Small caption under the format selector */
.format-hint {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.format-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
}

.format-btn:hover {
  color: #ffffff;
}

.format-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* 5. CENTER BOTTOM ACTION BUTTONS (Clean Minimalist Monochromatic Style) */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  white-space: nowrap;
}

.btn-icon {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

/* Minimalist Secondary Button (Copy Image) */
.action-btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.action-btn-secondary:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  transform: translateY(-2px);
}

.action-btn-secondary:hover .btn-icon {
  stroke: #000000;
  opacity: 1;
}

/* Minimalist Primary Button (Save Image) */
.action-btn-primary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.action-btn-primary:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(255, 255, 255, 0.15);
}

.action-btn-primary:hover .btn-icon {
  stroke: #000000;
  opacity: 1;
}

/* Loading state for buttons */
.action-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.action-btn.loading .btn-icon {
  animation: spin 1s linear infinite;
}

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

/* 6. FLOATING ACTION BUTTON (FAB - SUBTLE LINE BUTTON) */
.fab-button {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border-radius: 9999px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-fast);
}

.fab-icon {
  width: 15px;
  height: 15px;
  stroke: #ffffff;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab-text {
  font-size: 0.725rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.fab-button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.fab-button:hover .fab-icon {
  transform: rotate(180deg);
}

.fab-button:active {
  transform: translateY(0);
}

/* 7. TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  background: #ffffff;
  color: #000000;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 9999px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  animation: toastSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

.toast.toast-error {
  background: #f43f5e;
  color: #ffffff;
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.toast-dismiss {
  animation: toastFadeOut 0.3s ease forwards;
}

@keyframes toastFadeOut {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
}

/* 8. HIDDEN EXPORT CARD (1200x675px FOR CANVAS GENERATION) */
.export-hidden-wrapper {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1200px;
  height: 675px;
  overflow: hidden;
  pointer-events: none;
}

.export-card {
  position: relative;
  width: 1200px;
  height: 675px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #0a0a0a;
  overflow: hidden;
  box-sizing: border-box;
}

.export-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}

.export-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(10, 10, 10, 0.3) 0%, rgba(10, 10, 10, 0.75) 100%);
}

.export-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
  height: 100%;
  padding: 4rem 5rem;
  box-sizing: border-box;
  gap: 1.8rem;
}

.export-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 0.45rem 1.3rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.export-quote {
  font-family: var(--font-playfair);
  font-style: normal;
  font-weight: 400;
  font-size: 2.8rem;
  line-height: 1.35;
  color: #ffffff;
  max-width: 1000px;
  margin: 1.5rem 0;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.95), 0 2px 10px rgba(0,0,0,0.8);
  border: none;
  padding: 0;
  text-transform: none;
  font-variant: normal;
}

.export-author {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  font-style: normal;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.export-author::before,
.export-author::after {
  content: '';
  display: inline-block;
  width: 32px;
  height: 1px;
  background: rgba(255, 255, 255, 0.4);
}

.export-footer {
  margin-top: 0.5rem;
}

.export-brand {
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* 9. MEDIA QUERIES & RESPONSIVENESS */
@media (max-width: 640px) {
  .app-header {
    padding: 1.25rem 1.25rem;
  }

  .main-content {
    padding: 1rem 1rem 6rem 1rem;
  }

  .quote-mark {
    display: none;
  }

  .action-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
  }

  .action-btn {
    width: 200px;
    max-width: 85vw;
    justify-content: center;
  }

  .fab-button {
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.85rem 1.25rem;
  }
}