/**
 * Family Wish List - Responsive CSS
 * Supports both Christmas and Birthday themes
 * Fully responsive for mobile and desktop
 */

/* ============================================================================
   CSS VARIABLES & ROOT STYLES
   ============================================================================ */

:root {
  /* Christmas Theme Colors */
  --christmas-primary: #146B3A;
  --christmas-secondary: #8B0000;
  --christmas-accent: #FFD700;
  --christmas-bg-dark: #000000;
  --christmas-bg-light: #ffffff;
  --christmas-text-light: #ffffff;
  --christmas-text-dark: #333333;
  
  /* Birthday Theme Colors - Generic */
  --birthday-primary: #FF6B9D;
  --birthday-secondary: #4A90E2;
  --birthday-accent: #FFD93D;
  --birthday-bg-dark: #2C1810;
  --birthday-bg-light: #FFF5F7;
  --birthday-text-light: #ffffff;
  --birthday-text-dark: #333333;
  
  /* Arthur's Birthday Theme - Boy-themed (Refined Blues) */
  --arthur-primary: #42A5F5;
  --arthur-secondary: #26A69A;
  --arthur-accent: #66BB6A;
  --arthur-bg-light: #E8F5E9;
  --arthur-bg-gradient-1: #81C784;
  --arthur-bg-gradient-2: #4DB6AC;
  --arthur-text-dark: #1565C0;
  
  /* Penelope's Birthday Theme - 4-year-old Girl (Soft Pinks) */
  --penelope-primary: #F06292;
  --penelope-secondary: #BA68C8;
  --penelope-accent: #FFB74D;
  --penelope-bg-light: #FCE4EC;
  --penelope-bg-gradient-1: #F48FB1;
  --penelope-bg-gradient-2: #CE93D8;
  --penelope-text-dark: #C2185B;
  
  /* Common Colors */
  --white: #ffffff;
  --black: #000000;
  --gray-light: #f8f8f8;
  --gray-medium: #cccccc;
  --gray-dark: #666666;
  
  /* Spacing - Compact */
  --spacing-xs: 4px;
  --spacing-sm: 6px;
  --spacing-md: 12px;
  --spacing-lg: 18px;
  --spacing-xl: 24px;
  --spacing-xxl: 32px;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.25);
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

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

body {
  font-family: 'Arial', 'Helvetica', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--black);
  min-height: 100vh;
  margin: 0;
  padding: var(--spacing-md);
  transition: background-color 0.3s ease;
}

/* Christmas Theme Background */
body.christmas-theme {
  background-color: var(--christmas-bg-dark);
  background-image: url('background.png');
  background-repeat: repeat;
  background-size: 600px 400px;
  color: var(--white);
}

/* Birthday Theme Background - Generic */
body.birthday-theme {
  background: linear-gradient(135deg, #FFE5EC 0%, #FFF5F7 50%, #E5F3FF 100%);
  color: var(--birthday-text-dark);
}

/* Arthur's Birthday Theme - Boy Adventure (Polished) */
body.arthur-birthday-theme {
  background: linear-gradient(135deg, #E8F4F8 0%, #D1E9F6 50%, #B8DFF0 100%);
  color: var(--arthur-text-dark);
}

/* Penelope's Birthday Theme - Magical Princess (Polished) */
body.penelope-birthday-theme {
  background: linear-gradient(135deg, #FFF0F5 0%, #FFE4EC 50%, #FFD6E8 100%);
  color: var(--penelope-text-dark);
}

/* ============================================================================
   CONTENT WRAPPER
   ============================================================================ */

.content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-lg);
  position: relative;
}

@media (max-width: 768px) {
  body {
    padding: var(--spacing-sm);
  }
  
  .content-wrapper {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
  }
}

/* ============================================================================
   HEADER STYLES
   ============================================================================ */

header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px dashed var(--gray-medium);
}

header h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  margin-bottom: var(--spacing-sm);
  transition: color 0.3s ease;
}

.christmas-theme header h1 {
  color: var(--christmas-secondary);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.birthday-theme header h1 {
  color: var(--birthday-primary);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

header .subtitle {
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: var(--gray-dark);
  margin-bottom: var(--spacing-xs);
  line-height: 1.4;
}

header .note {
  font-size: clamp(0.8rem, 1.8vw, 0.9rem);
  font-weight: bold;
  margin-top: var(--spacing-sm);
}

.christmas-theme header .note {
  color: var(--christmas-secondary);
}

.birthday-theme header .note {
  color: var(--birthday-secondary);
}

/* ============================================================================
   COUNTDOWN SECTION
   ============================================================================ */

.countdown-section {
  margin-bottom: var(--spacing-lg);
  text-align: center;
}

.countdown-section h2 {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  margin-bottom: var(--spacing-md);
  padding: 0;
  display: block;
  font-weight: bold;
}

.christmas-theme .countdown-section h2 {
  color: var(--christmas-primary);
}

.birthday-theme .countdown-section h2 {
  color: var(--birthday-primary);
}

.arthur-birthday-theme .countdown-section h2 {
  color: var(--arthur-primary);
}

.penelope-birthday-theme .countdown-section h2 {
  color: var(--penelope-primary);
}

.countdown-container {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
}

.countdown-box {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.countdown-box:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.christmas-theme .countdown-box {
  background: linear-gradient(135deg, var(--christmas-primary), var(--christmas-secondary));
  color: var(--white);
}

.birthday-theme .countdown-box {
  background: linear-gradient(135deg, var(--birthday-primary), var(--birthday-secondary));
  color: var(--white);
}

.arthur-birthday-theme .countdown-box {
  background: linear-gradient(135deg, var(--arthur-primary), var(--arthur-secondary));
  color: var(--white);
  box-shadow: 0 4px 12px rgba(66, 165, 245, 0.25);
}

.penelope-birthday-theme .countdown-box {
  background: linear-gradient(135deg, var(--penelope-primary), var(--penelope-secondary));
  color: var(--white);
  box-shadow: 0 4px 12px rgba(240, 98, 146, 0.25);
}

.countdown-number {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: bold;
  margin-bottom: 2px;
}

.countdown-label {
  font-size: clamp(0.75rem, 1.5vw, 0.85rem);
  opacity: 0.9;
  margin-bottom: var(--spacing-xs);
}

.event-name {
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-weight: bold;
  margin-bottom: 2px;
}

.event-date {
  font-size: clamp(0.75rem, 1.5vw, 0.85rem);
  opacity: 0.8;
}

@media (max-width: 768px) {
  .countdown-container {
    flex-direction: column;
    align-items: center;
  }
  
  .countdown-box {
    width: 100%;
    max-width: none;
  }
}

/* ============================================================================
   CHILD SELECTOR SECTION
   ============================================================================ */

.child-selector-section {
  margin-bottom: var(--spacing-lg);
  text-align: center;
}

.child-selector-section h2 {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  margin-bottom: var(--spacing-md);
  padding: 0;
  display: block;
  font-weight: bold;
}

.christmas-theme .child-selector-section h2 {
  color: var(--christmas-primary);
}

.birthday-theme .child-selector-section h2 {
  color: var(--birthday-secondary);
}

.arthur-birthday-theme .child-selector-section h2 {
  color: var(--arthur-primary);
}

.penelope-birthday-theme .child-selector-section h2 {
  color: var(--penelope-primary);
}

.child-selector {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
}

.child-button {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
  padding: var(--spacing-md);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  box-shadow: var(--shadow-sm);
}

.child-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.child-button.active {
  box-shadow: var(--shadow-lg);
}

.christmas-theme .child-button.active {
  border-color: var(--christmas-primary);
  background: linear-gradient(to bottom, var(--white), #f0fdf4);
}

.birthday-theme .child-button.active {
  border-color: var(--birthday-primary);
  background: linear-gradient(to bottom, var(--white), #fef3f5);
}

.arthur-birthday-theme .child-button.active {
  border-color: var(--arthur-primary);
  background: linear-gradient(to bottom, var(--white), #E8F5E9);
  box-shadow: 0 4px 8px rgba(66, 165, 245, 0.2);
}

.penelope-birthday-theme .child-button.active {
  border-color: var(--penelope-primary);
  background: linear-gradient(to bottom, var(--white), var(--penelope-bg-light));
  box-shadow: 0 4px 8px rgba(240, 98, 146, 0.2);
}

.child-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--white);
  transition: transform 0.3s ease;
}

.child-button:hover .child-icon {
  transform: scale(1.05);
}

.arthur-button .child-icon {
  background: linear-gradient(135deg, #4A90E2, #2E5C8A);
}

.penelope-button .child-icon {
  background: linear-gradient(135deg, #FF6B9D, #D94976);
}

.child-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--gray-dark);
}

@media (max-width: 768px) {
  .child-selector {
    flex-direction: column;
    align-items: center;
  }
  
  .child-button {
    width: 100%;
    max-width: none;
  }
}

/* ============================================================================
   MODE TOGGLE SECTION
   ============================================================================ */

.mode-toggle-section {
  margin-bottom: var(--spacing-lg);
  text-align: center;
}

.mode-toggle-button {
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 0.95rem;
  font-weight: bold;
  border: 2px solid;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.mode-toggle-button:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.christmas-theme .mode-toggle-button {
  background: var(--christmas-secondary);
  border-color: var(--christmas-secondary);
}

.birthday-theme .mode-toggle-button {
  background: var(--birthday-secondary);
  border-color: var(--birthday-secondary);
}

.arthur-birthday-theme .mode-toggle-button {
  background: var(--arthur-secondary);
  border-color: var(--arthur-secondary);
}

.penelope-birthday-theme .mode-toggle-button {
  background: var(--penelope-secondary);
  border-color: var(--penelope-secondary);
}

/* ============================================================================
   ERROR MESSAGE
   ============================================================================ */

.error-message {
  background-color: #fee;
  border: 2px solid #f88;
  color: #c00;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
  text-align: center;
  font-weight: bold;
}

/* ============================================================================
   SECTIONS CONTAINER
   ============================================================================ */

.sections-container {
  display: grid;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

/* Desktop layout - 2 columns for first two sections, full width for form */
@media (min-width: 992px) {
  .sections-container {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .form-section {
    grid-column: 1 / -1;
  }
}

/* Tablet and mobile - single column */
@media (max-width: 991px) {
  .sections-container {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   SECTION ITEMS
   ============================================================================ */

.section-item {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
}

.section-item:hover {
  box-shadow: var(--shadow-lg);
}

.section-item h2 {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  margin-bottom: var(--spacing-sm);
  padding: 0;
  display: block;
  font-weight: bold;
}

.christmas-theme .section-item h2 {
  color: var(--christmas-primary);
}

.birthday-theme .section-item h2 {
  color: var(--birthday-primary);
}

.arthur-birthday-theme .section-item h2 {
  color: var(--arthur-primary);
}

.penelope-birthday-theme .section-item h2 {
  color: var(--penelope-primary);
}

.section-item p {
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: var(--gray-dark);
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
}

/* ============================================================================
   TABLE STYLES
   ============================================================================ */

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  font-weight: bold;
  color: var(--white);
  font-size: clamp(0.85rem, 1.8vw, 0.95rem);
}

.christmas-theme th {
  background-color: var(--christmas-primary);
}

.birthday-theme th {
  background-color: var(--birthday-primary);
}

.arthur-birthday-theme th {
  background: linear-gradient(135deg, var(--arthur-primary), var(--arthur-secondary));
}

.penelope-birthday-theme th {
  background: linear-gradient(135deg, var(--penelope-primary), var(--penelope-secondary));
}

td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--gray-light);
  font-size: clamp(0.8rem, 1.8vw, 0.9rem);
  color: var(--black);
  background-color: var(--white);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: var(--gray-light);
}

td.no-selection,
td.empty,
td.loading {
  text-align: center;
  color: var(--gray-dark);
  font-style: italic;
  padding: var(--spacing-xl);
}

td a {
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

.christmas-theme td a {
  color: var(--christmas-secondary);
}

.birthday-theme td a {
  color: var(--birthday-secondary);
}

.arthur-birthday-theme td a {
  color: var(--arthur-primary);
  font-weight: bold;
}

.penelope-birthday-theme td a {
  color: var(--penelope-primary);
  font-weight: bold;
}

td a:hover {
  text-decoration: underline;
}

/* ============================================================================
   BUTTON STYLES
   ============================================================================ */

.purchase-button {
  padding: var(--spacing-xs) var(--spacing-sm);
  border: none;
  border-radius: var(--radius-sm);
  font-size: clamp(0.8rem, 1.8vw, 0.9rem);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.purchase-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.christmas-theme .purchase-button {
  background: var(--christmas-primary);
}

.birthday-theme .purchase-button {
  background: var(--birthday-secondary);
}

.arthur-birthday-theme .purchase-button {
  background: linear-gradient(135deg, var(--arthur-primary), var(--arthur-secondary));
}

.penelope-birthday-theme .purchase-button {
  background: linear-gradient(135deg, var(--penelope-primary), var(--penelope-secondary));
}

@media (max-width: 768px) {
  table {
    font-size: 0.85rem;
  }
  
  th, td {
    padding: var(--spacing-sm);
  }
  
  .purchase-button {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
  }
}

/* ============================================================================
   FORM STYLES
   ============================================================================ */

.add-item-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-group label {
  font-weight: bold;
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: var(--gray-dark);
}

.form-group .required {
  color: #c00;
}

.form-group input,
.form-group textarea {
  padding: var(--spacing-md);
  border: 2px solid var(--gray-medium);
  border-radius: var(--radius-md);
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-family: inherit;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.christmas-theme .form-group input:focus,
.christmas-theme .form-group textarea:focus {
  border-color: var(--christmas-primary);
}

.birthday-theme .form-group input:focus,
.birthday-theme .form-group textarea:focus {
  border-color: var(--birthday-primary);
}

.arthur-birthday-theme .form-group input:focus,
.arthur-birthday-theme .form-group textarea:focus {
  border-color: var(--arthur-primary);
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

.penelope-birthday-theme .form-group input:focus,
.penelope-birthday-theme .form-group textarea:focus {
  border-color: var(--penelope-primary);
  box-shadow: 0 0 0 3px rgba(236, 64, 122, 0.2);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.submit-button {
  padding: var(--spacing-md) var(--spacing-xl);
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--white);
  box-shadow: var(--shadow-sm);
  align-self: flex-start;
}

.submit-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.christmas-theme .submit-button {
  background: var(--christmas-secondary);
}

.birthday-theme .submit-button {
  background: var(--birthday-secondary);
}

.arthur-birthday-theme .submit-button {
  background: linear-gradient(135deg, var(--arthur-primary), var(--arthur-secondary));
  font-weight: bold;
}

.penelope-birthday-theme .submit-button {
  background: linear-gradient(135deg, var(--penelope-primary), var(--penelope-secondary));
  font-weight: bold;
}

@media (max-width: 768px) {
  .submit-button {
    align-self: stretch;
  }
}

/* ============================================================================
   FOOTER STYLES
   ============================================================================ */

.footer {
  text-align: center;
  padding: var(--spacing-lg) var(--spacing-md);
  margin-top: var(--spacing-lg);
  border-top: 2px dashed var(--gray-medium);
  color: var(--gray-dark);
}

.footer p {
  margin-bottom: var(--spacing-sm);
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.footer-note {
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  font-style: italic;
  opacity: 0.8;
}

/* ============================================================================
   DECORATIVE ELEMENTS (Placeholder for snowflakes, balloons, etc.)
   ============================================================================ */

#decorations {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ============================================================================
   LOADING OVERLAY
   ============================================================================ */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.loading-overlay.show {
  display: flex;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-content {
  text-align: center;
  background: white;
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.loading-content p {
  margin-top: var(--spacing-md);
  font-weight: bold;
  color: var(--gray-dark);
}

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

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.text-center {
  text-align: center;
}

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

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

.section-item {
  animation: fadeIn 0.5s ease-out;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
  body {
    background: white;
  }
  
  .content-wrapper {
    box-shadow: none;
  }
  
  .mode-toggle-section,
  .child-selector-section,
  .countdown-section,
  .form-section,
  #decorations {
    display: none;
  }
  
  .purchase-button {
    display: none;
  }
}

