/* PicksPage Vintage Theme Enhancement
   정적이고 오래된 사이트 컨셉을 유지하면서 완성도를 높이는 스타일 
   Version: 1.0.2 - 2025-08-04 */

/* ===========================
   1. CSS Variables & Foundation
   =========================== */
:root {
  /* Vintage Color Palette */
  --vintage-paper: #faf8f3;
  --vintage-paper-dark: #f5f2e8;
  --vintage-ink: #2d2013;
  --vintage-ink-soft: #4a4333;
  --vintage-accent: #8b5a3c;
  --vintage-accent-light: #a67c5d;
  --vintage-gold: #d4af37;
  --vintage-red: #c44536;
  --vintage-blue: #4a6fa5;
  --vintage-green: #5d7a65;
  
  /* Spacing System */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  /* Font Stacks */
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ===========================
   2. Typography Enhancement
   =========================== */

/* Body text with better readability */
body {
  font-family: var(--font-sans);
  color: var(--vintage-ink);
  line-height: 1.6;
  letter-spacing: 0.01em;
  background-color: var(--vintage-paper);
  font-size: var(--text-base);
}

/* Headings with vintage serif touch */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--vintage-ink);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.5em;
}

h1 { 
  font-size: var(--text-4xl);
  font-weight: 700;
}

h2 { 
  font-size: var(--text-3xl);
  font-weight: 600;
}

h3 { 
  font-size: var(--text-2xl);
  font-weight: 600;
}

/* Navigation & Brand refinement */
nav .text-lg.font-bold {
  font-family: 'Playfair Display', var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--vintage-accent);
  transition: all var(--transition-base);
  text-shadow: 0 1px 2px rgba(45, 32, 19, 0.1);
}

nav .text-lg.font-bold:hover {
  color: var(--vintage-accent-light);
  transform: translateY(-1px);
}

/* ===========================
   3. Card & Surface Styling
   =========================== */

/* Enhanced card styling with better depth */
.bg-white.rounded-lg.shadow,
.bg-white.overflow-hidden.shadow.rounded-lg {
  background: white;
  border: 1px solid rgba(139, 90, 60, 0.08);
  box-shadow: 
    0 1px 3px rgba(45, 32, 19, 0.06),
    0 4px 8px rgba(45, 32, 19, 0.03);
  transition: all var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.bg-white.rounded-lg.shadow:hover,
.bg-white.overflow-hidden.shadow.rounded-lg:hover {
  box-shadow: 
    0 4px 12px rgba(45, 32, 19, 0.12),
    0 8px 24px rgba(45, 32, 19, 0.06);
  transform: translateY(-2px);
  border-color: rgba(139, 90, 60, 0.15);
}

/* Card hover effect with subtle glow */
.bg-white.rounded-lg.shadow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(212, 175, 55, 0.03) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.bg-white.rounded-lg.shadow:hover::before {
  opacity: 1;
}

/* Pick cards in edit mode */
.edit-mode-highlight {
  background-color: rgba(212, 175, 55, 0.08) !important;
  border-color: var(--vintage-gold) !important;
  border-width: 2px !important;
}

/* ===========================
   4. Button Refinement
   =========================== */

/* Primary button with vintage accent */
.bg-indigo-600,
.bg-indigo-600.hover\:bg-indigo-700:hover {
  background-color: var(--vintage-accent);
  transition: all var(--transition-fast);
}

.bg-indigo-600:hover:not(:disabled),
.hover\:bg-indigo-700:hover:not(:disabled) {
  background-color: var(--vintage-accent-light);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(139, 90, 60, 0.2);
}

/* Disabled button state */
button:disabled,
button[disabled] {
  transform: none !important;
  cursor: not-allowed !important;
}

/* Smooth transitions for button states */
button {
  transition: all 200ms ease;
}

/* Loading spinner animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Secondary buttons */
.border-gray-300 {
  border-color: rgba(139, 90, 60, 0.2);
}

.text-gray-700 {
  color: var(--vintage-ink-soft);
}

/* Button text refinement */
button, a[role="button"], .btn {
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all var(--transition-fast);
}

/* ===========================
   5. Form & Input Styling
   =========================== */

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  background-color: white !important;
  border: 1px solid rgba(139, 90, 60, 0.2) !important;
  color: var(--vintage-ink) !important;
  transition: all var(--transition-fast);
  -webkit-text-fill-color: var(--vintage-ink) !important;
  opacity: 1 !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  background-color: white;
  border-color: var(--vintage-accent);
  box-shadow: 0 0 0 3px rgba(139, 90, 60, 0.1);
}

/* ===========================
   6. Layout & Spacing Improvements
   =========================== */

/* Hero section enhancement */
.bg-gradient-to-r.from-purple-800.to-indigo-700 {
  background: linear-gradient(135deg, var(--vintage-accent) 0%, var(--vintage-blue) 100%);
}

/* Section spacing */
.py-8 {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

/* Card spacing in grid */
.gap-6 {
  gap: var(--space-xl);
}

/* ===========================
   7. Micro-interactions
   =========================== */

/* Link hover effects */
a:not(.bg-indigo-600):not([role="button"]) {
  transition: color var(--transition-fast);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:not(.bg-indigo-600):not([role="button"]):hover {
  color: var(--vintage-accent);
  text-decoration: underline;
}

/* Image hover effects */
img {
  transition: transform var(--transition-base);
}

.group:hover img {
  transform: scale(1.02);
}

/* ===========================
   8. Topic & Profile Pages
   =========================== */

/* Profile mini box enhancement */
.bg-gray-50 {
  background-color: var(--vintage-paper-dark);
}

/* Topic title styling */
#topic-header h1 {
  margin-bottom: 0.25em;
}

/* Picks count styling */
.text-2xl.font-bold .relative {
  font-family: var(--font-serif);
  color: var(--vintage-accent);
}

/* Navigation breadcrumb styling */
.fixed.top-1 a {
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 3px rgba(45, 32, 19, 0.1);
}

/* ===========================
   9. Mobile Responsiveness
   =========================== */

@media (max-width: 640px) {
  :root {
    --text-base: 0.9375rem;
  }
  
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
}

/* ===========================
   10. Loading & Transition States
   =========================== */

/* HTMX loading overlay refinement */
.htmx-request .htmx-indicator {
  background-color: rgba(250, 248, 243, 0.9);
}

/* Alpine.js transitions */
[x-cloak] { 
  display: none !important; 
}

/* Edit mode banner */
.bg-yellow-50 {
  background-color: rgba(212, 175, 55, 0.1);
  border-color: var(--vintage-gold);
}

.text-yellow-800 {
  color: var(--vintage-accent);
}

.bg-yellow-100 {
  background-color: rgba(212, 175, 55, 0.2);
}

/* ===========================
   11. Accessibility Enhancements
   =========================== */

/* Focus states */
:focus-visible {
  outline: 2px solid var(--vintage-accent);
  outline-offset: 2px;
}

/* Skip to content */
.sr-only:focus {
  position: absolute;
  width: auto;
  height: auto;
  padding: var(--space-sm) var(--space-md);
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
  background-color: white;
  box-shadow: 0 2px 4px rgba(45, 32, 19, 0.2);
}

/* ===========================
   12. Special Effects
   =========================== */

/* Subtle paper texture overlay - DISABLED to fix input issues */
/* body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 35px,
      rgba(139, 90, 60, 0.01) 35px,
      rgba(139, 90, 60, 0.01) 70px
    );
  pointer-events: none;
  z-index: 0;
} */

/* Remove the conflicting z-index rule that was causing dropdown issues */

/* Vintage-style selection */
::selection {
  background-color: rgba(212, 175, 55, 0.3);
  color: var(--vintage-ink);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--vintage-paper);
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 90, 60, 0.3);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 90, 60, 0.5);
}

/* ===========================
   13. Z-index Fixes
   =========================== */

/* Fix dropdown menu z-index issue */
.z-50 {
  z-index: 9999 !important;
}

/* Navigation styling */
nav {
  position: relative;
  z-index: 40;
}

/* Navigation bar background fix */
nav.bg-white {
  background-color: white;
}

/* Dropdown container needs higher z-index */
nav .relative {
  z-index: 9999 !important;
}

/* Navigation dropdown specific fix */
nav .relative > div[x-show="open"] {
  z-index: 9999 !important;
  position: absolute !important;
  background-color: white !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

/* ===========================
   14. Additional Enhancements
   =========================== */

/* Topic count styling */
.text-gray-500:has(+ .text-gray-900),
.text-gray-500.text-sm {
  color: var(--vintage-accent);
  font-weight: 500;
}

/* Profile page enhancements */
.rounded-full {
  border: 2px solid rgba(212, 175, 55, 0.2);
  transition: all var(--transition-base);
}

.rounded-full:hover {
  border-color: rgba(212, 175, 55, 0.5);
  transform: scale(1.05);
}

/* Topic title on cards */
.text-xl.font-bold.text-gray-900,
.text-lg.font-medium.text-gray-900 {
  font-family: var(--font-serif);
  color: var(--vintage-ink);
  transition: color var(--transition-fast);
}

a:hover .text-xl.font-bold.text-gray-900,
a:hover .text-lg.font-medium.text-gray-900 {
  color: var(--vintage-accent);
}

/* Picks count badge */
.text-sm.text-gray-500:last-child {
  background-color: rgba(212, 175, 55, 0.1);
  padding: 0.125rem 0.5rem;
  border-radius: 1rem;
  color: var(--vintage-accent);
  font-weight: 600;
  transition: all var(--transition-fast);
}

/* Footer refinement */
footer {
  border-top: 1px solid rgba(139, 90, 60, 0.1);
  background-color: rgba(250, 248, 243, 0.5);
}

/* Tab navigation enhancement */
button[class*="border-b-2"] {
  transition: all var(--transition-base);
  position: relative;
}

button[class*="border-indigo-500"] {
  border-color: var(--vintage-accent) !important;
  color: var(--vintage-accent) !important;
}

/* Search input enhancement */
input[type="text"][placeholder*="Search"] {
  font-size: 0.9375rem;
  padding-left: 2.5rem;
}

input[type="text"][placeholder*="Search"]:focus {
  background-color: white;
  box-shadow: 
    0 0 0 3px rgba(139, 90, 60, 0.1),
    0 2px 4px rgba(45, 32, 19, 0.05);
}

/* Sort buttons enhancement */
button[class*="bg-indigo-100"] {
  background-color: rgba(139, 90, 60, 0.1) !important;
  color: var(--vintage-accent) !important;
  font-weight: 500;
}

button[class*="text-gray-700"]:not([class*="bg-indigo-100"]) {
  color: var(--vintage-ink-soft);
}

button[class*="text-gray-700"]:hover {
  background-color: rgba(139, 90, 60, 0.05);
  color: var(--vintage-accent);
}

/* Empty state enhancement */
.text-gray-400 {
  color: var(--vintage-ink-soft);
  opacity: 0.7;
}

/* Time/date styling */
time, .text-xs.text-gray-500 {
  color: var(--vintage-ink-soft);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

/* Get Inspired button */
a[href*="inspired_by"] {
  color: var(--vintage-blue) !important;
  font-weight: 500;
  transition: all var(--transition-fast);
}

a[href*="inspired_by"]:hover {
  color: var(--vintage-accent) !important;
  transform: translateX(2px);
}

/* Mini profile box enhancement */
.bg-gray-50:has(img) {
  background: linear-gradient(135deg, var(--vintage-paper-dark) 0%, var(--vintage-paper) 100%);
  border: 1px solid rgba(139, 90, 60, 0.08);
}

/* Form input text color fix for Tailwind classes */
.text-gray-900 {
  color: var(--vintage-ink) !important;
}

/* Ensure form inputs have proper text color */
input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
  color: rgba(74, 67, 51, 0.5) !important;
  opacity: 1 !important;
  -webkit-text-fill-color: rgba(74, 67, 51, 0.5) !important;
}

/* Force input text visibility with higher specificity */
form input[type="text"],
form input[type="email"],
form input[type="password"],
form textarea {
  color: #2d2013 !important;
  -webkit-text-fill-color: #2d2013 !important;
  background-color: #ffffff !important;
  opacity: 1 !important;
}

/* Specific fix for topic form */
input#id_title {
  color: #2d2013 !important;
  -webkit-text-fill-color: #2d2013 !important;
  background-color: #ffffff !important;
}

/* Debug: Force all text inputs to be visible */
input[type="text"]:not([readonly]) {
  color: #2d2013 !important;
  -webkit-text-fill-color: #2d2013 !important;
  background-color: #ffffff !important;
  border: 1px solid #8b5a3c !important;
}

/* Ensure forms and inputs are interactive */
form {
  position: relative;
  z-index: 10;
}

input, textarea, select, button {
  position: relative;
  z-index: 10;
}

/* Fix for shadow div blocking input */
.bg-white.shadow.rounded-lg {
  position: relative;
  z-index: 1;
}

/* REMOVED: Overly broad positioning rule that breaks absolute positioning
.bg-white.shadow.rounded-lg * {
  position: relative;
  z-index: auto;
}
*/

/* ===========================
   15. Pick Preview Styling
   =========================== */

/* Pick preview container styling */
.pick-preview-container {
  background-color: #ebe6d6; /* 더 진한 빈티지 배경색 */
  border: 1px solid rgba(139, 90, 60, 0.15);
  border-radius: 6px;
  padding: 0.5rem;
  transition: all var(--transition-base);
  text-align: right;
}

/* Individual pick preview items */
.pick-preview-item {
  color: #6b7280;
  margin-bottom: 0.25rem;
  line-height: 1.3;
  transition: color var(--transition-fast);
  font-size: 0.7rem; /* 원래 크기로 복원 */
}

.pick-preview-item:last-of-type {
  margin-bottom: 0;
}

/* More picks indicator */
.pick-preview-more {
  color: var(--vintage-accent-light);
  font-weight: 600;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(139, 90, 60, 0.08);
}

/* Hover effect on topic card */
.topic-card:hover .pick-preview-container {
  background-color: #e3dcc9; /* 호버시 더 진하게 */
  border-color: rgba(139, 90, 60, 0.2);
}

.topic-card:hover .pick-preview-item {
  color: #4a4333; /* Darker text on hover */
}

/* Mobile optimization */
@media (max-width: 640px) {
  .pick-preview-container {
    padding: 0.375rem;
  }
  
  .pick-preview-item {
    font-size: 0.65rem; /* 모바일에서만 약간 작게 */
  }
  
  .pick-preview-more {
    font-size: 0.7rem;
  }
}

/* Ensure good contrast for accessibility */
@media (prefers-contrast: high) {
  .pick-preview-container {
    background-color: #ddd5c0;
    border-color: rgba(139, 90, 60, 0.4);
  }
  
  .pick-preview-item {
    color: #4a4333;
  }
}

/* ===========================
   16. Pick Card Positioning Fixes
   =========================== */

/* Fix absolute positioning for pick card controls */
.pick-card .absolute {
  position: absolute !important;
}

/* Ensure edit controls stay in bottom-right */
.pick-card .absolute.right-2.bottom-2 {
  position: absolute !important;
  right: 0.5rem !important;
  bottom: 0.5rem !important;
  z-index: 20 !important;
}

/* Ensure drag handle stays in middle-right */
.pick-card .drag-handle {
  position: absolute !important;
  right: 0.5rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 30 !important;
}

/* Mobile optimization: prevent touch target overlap */
@media (hover: none) and (pointer: coarse) {
  .pick-card .drag-handle {
    right: 3.5rem !important; /* Offset to avoid edit button collision */
  }
  
  /* Always show edit controls on touch devices */
  .pick-card .absolute.right-2.bottom-2 {
    opacity: 1 !important;
  }
}

/* Ensure proper stacking context */
.pick-card {
  isolation: isolate;
}