@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
  --bg-primary: #15161C;
  --bg-secondary: #1E202B;
  --bg-tertiary: #272A38;
  
  --burgundy: #4A0E17;
  --burgundy-light: #6B1B26;
  --burgundy-dark: #2B070C;
  
  --accent-color: #C9A84C;
  --gold: var(--accent-color);
  --gold-light: var(--accent-color);
  --gold-dark: var(--accent-color);
  
  --text-primary: #F5F0E8;   /* Creamy white */
  --text-secondary: #A09E9A; /* Muted text */
  --text-muted: #666461;
  
  --border-color: rgba(201, 168, 76, 0.15); /* Semi-transparent gold border */
  --border-color-hover: rgba(201, 168, 76, 0.4);
  
  /* Fonts */
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Glassmorphism & Shadow */
  --glass-bg: rgba(18, 18, 18, 0.8);
  --glass-backdrop: blur(12px);
  --box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  
  /* Layout */
  --header-height: 70px;
  --max-width: 935px; /* Standard Instagram Feed width */
}

/* Light Theme Variables */
body.light-theme {
  --bg-primary: #FDFBF7;
  --bg-secondary: #F6F1E9;
  --bg-tertiary: #EBE5D8;
  --text-primary: #1A0D0F;
  --text-secondary: #5A4A42;
  --text-muted: #8A7A70;
  --border-color: rgba(74, 14, 23, 0.15);
  --border-color-hover: rgba(74, 14, 23, 0.4);
  --glass-bg: rgba(253, 251, 247, 0.85);
  --box-shadow: 0 8px 32px 0 rgba(74, 14, 23, 0.08);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* Typography Utilities */
.font-serif { font-family: var(--font-serif); }
.font-sans { font-family: var(--font-sans); }

.text-gold { color: var(--gold); }
.text-burgundy { color: var(--burgundy-light); }
.text-muted { color: var(--text-secondary); }

/* Layout Elements */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header styling */
header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background-color: var(--glass-bg);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

header.header-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

header .header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: radial-gradient(circle, var(--burgundy-light) 0%, var(--burgundy) 100%);
  border: 1px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--gold);
  box-shadow: 0 0 10px rgba(201, 168, 76, 0.2);
}

.logo-text {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Lang Switcher */
.lang-switcher {
  display: flex;
  gap: 5px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: 20px;
}

.lang-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 17px;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.lang-btn.active {
  background-color: var(--gold);
  color: var(--bg-primary);
  box-shadow: 0 2px 10px rgba(201, 168, 76, 0.3);
}

/* Category Filter Bar */
.category-bar {
  margin: 30px 0;
  overflow-x: auto;
  white-space: nowrap;
  display: flex;
  gap: 10px;
  padding: 5px 0;
  scrollbar-width: none; /* Hide scrollbar Firefox */
}

.category-bar::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

.category-chip {
  padding: 8px 18px;
  border-radius: 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.category-chip:hover {
  border-color: var(--border-color-hover);
  color: var(--gold);
  transform: translateY(-2px);
}

.category-chip.active {
  background-color: var(--burgundy);
  border-color: var(--gold);
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(74, 14, 23, 0.4);
}

/* Grid Layout for Cards */
.quotes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 50px;
}

@media (max-width: 768px) {
  .quotes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .quotes-grid {
    grid-template-columns: repeat(1, 1fr);
    gap: 15px;
  }
}

/* Quote Card styling */
.quote-card {
  position: relative;
  aspect-ratio: 1 / 1;
  background-color: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--box-shadow);
  cursor: pointer;
}

.quote-card:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: var(--gold);
  box-shadow: 0 12px 40px rgba(201, 168, 76, 0.15);
}

.card-img-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.4s ease;
}

.quote-card:hover .card-img-placeholder {
  filter: brightness(0.3) blur(2px);
}

/* Content on top of image for layout card */
.card-content-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 2;
  background: linear-gradient(135deg, rgba(74, 14, 23, 0.4) 0%, rgba(10, 10, 10, 0.6) 100%);
}

.card-quote-text {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-style: italic;
  font-weight: 500;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 12px;
  line-height: 1.4;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.card-quote-author {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Overlay that appears on Hover (Instagram-style Stats) */
.card-hover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 3;
}

.quote-card:hover .card-hover-overlay {
  opacity: 1;
}

.overlay-stats {
  display: flex;
  gap: 25px;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 15px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-item svg {
  fill: currentColor;
  width: 20px;
  height: 20px;
}

.overlay-view-btn {
  padding: 8px 18px;
  border-radius: 20px;
  background-color: var(--gold);
  color: var(--bg-primary);
  font-weight: 600;
  font-size: 0.85rem;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quote-card:hover .overlay-view-btn {
  transform: translateY(0);
}

.overlay-view-btn:hover {
  background-color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

/* Footer */
footer {
  margin-top: 80px;
  padding: 40px 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-secondary);
}

.footer-bio {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-style: italic;
  margin-bottom: 15px;
}

.footer-social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 25px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-weight: 600;
  margin-bottom: 20px;
}

.footer-social-link:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Modal styling (Desktop Dialog) */
dialog.quote-dialog {
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 12px;
  max-width: 1050px;
  width: 90%;
  box-shadow: var(--box-shadow);
  padding: 0;
  overflow: hidden;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  outline: none;
}

/* Backdrop styles using native popover animations or simple css standard transition */
dialog.quote-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

/* Dialog content structure */
.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  height: 600px;
  max-height: 80vh;
}

@media (max-width: 768px) {
  dialog.quote-dialog {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
    border: none;
  }
  
  .dialog-grid {
    grid-template-columns: 1fr;
    height: 100vh;
    overflow-y: auto;
  }
}

.dialog-media {
  background-color: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

@media (max-width: 768px) {
  .dialog-media {
    aspect-ratio: 1/1;
  }
}

.dialog-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dialog-details {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  height: 100%;
  overflow: hidden;
}

@media (max-width: 768px) {
  .dialog-details {
    border-left: none;
    border-top: 1px solid var(--border-color);
    height: auto;
  }
}

/* Header inside dialog (Author & close button) */
.dialog-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-tertiary);
}

.dialog-author-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dialog-author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--burgundy);
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--gold);
}

.dialog-author-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.dialog-close-btn {
  font-size: 1.5rem;
  color: var(--text-secondary);
  line-height: 1;
}

.dialog-close-btn:hover {
  color: var(--gold);
}

/* Main body scroll section for Comments & Caption */
.dialog-scroll-area {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dialog-caption {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--border-color);
}

.caption-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--burgundy-dark);
  border: 1px solid var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--gold);
}

.caption-text {
  font-size: 0.95rem;
  line-height: 1.5;
}

.quote-citation {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--gold);
}

/* Comments Section */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.comment-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.comment-content {
  background-color: var(--bg-tertiary);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  flex-grow: 1;
}

.comment-author-name {
  font-weight: 700;
  margin-bottom: 2px;
  font-size: 0.85rem;
}

.comment-text {
  color: var(--text-primary);
  line-height: 1.4;
}

.comment-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Dialog Footer (Comment form & buttons) */
.dialog-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.action-buttons {
  display: flex;
  gap: 15px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.action-btn:hover {
  color: var(--gold);
}

.action-btn.liked {
  color: #ff3040;
}

.action-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Add Comment Form */
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.comment-input-row {
  display: flex;
  gap: 10px;
}

.comment-input-row input {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  width: 50%;
}

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

.comment-input-row input:focus {
  border-color: var(--gold);
}

.comment-text-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.comment-text-row textarea {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
  resize: none;
  height: 70px;
  outline: none;
  transition: all 0.2s ease;
}

.comment-text-row textarea:focus {
  border-color: var(--gold);
}

.comment-submit-btn {
  background-color: var(--gold);
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 24px;
  border-radius: 20px;
  transition: all 0.2s ease;
  height: 40px;
}

.comment-submit-btn:hover {
  background-color: var(--text-primary);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* OTP Modal */
.otp-dialog {
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--box-shadow);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  outline: none;
}

.otp-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.otp-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: 10px;
}

.otp-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.otp-input-field {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 4px;
  width: 100%;
  margin-bottom: 20px;
  outline: none;
}

.otp-input-field:focus {
  border-color: var(--gold);
}

.otp-buttons {
  display: flex;
  gap: 10px;
}

.otp-btn {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.otp-btn-confirm {
  background-color: var(--gold);
  color: var(--bg-primary);
}

.otp-btn-confirm:hover {
  background-color: var(--text-primary);
}

.otp-btn-cancel {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.otp-btn-cancel:hover {
  border-color: var(--text-secondary);
}

/* Animations support */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-element {
  animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Loader spinner */
.loader-spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(201, 168, 76, 0.1);
  border-radius: 50%;
  border-top-color: var(--gold);
  animation: spin 1s ease-in-out infinite;
}

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