/* ============================================
   Wedding Seating Chart — Pastel Pink Theme
   ============================================ */

/* ---- CSS Custom Properties ---- */
:root {
    --pink-50: #FFF0F3;
    --pink-100: #FFE0E8;
    --pink-200: #FFD6E0;
    --pink-300: #FFC2D1;
    --pink-400: #FFADC4;
    --pink-500: #E8A0B4;
    --pink-600: #C77D91;
    --pink-700: #A3606F;
    --pink-800: #7D4452;
    --pink-900: #5A2D3A;

    --text-primary: #2D2D2D;
    --text-secondary: #5A5A5A;
    --text-muted: #8A8A8A;
    --text-on-pink: #5A2D3A;

    --white: #FFFFFF;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(255, 210, 224, 0.5);
    --shadow-soft: 0 4px 24px rgba(199, 125, 145, 0.12);
    --shadow-medium: 0 8px 40px rgba(199, 125, 145, 0.18);
    --shadow-glow: 0 0 40px rgba(232, 160, 180, 0.25);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 50%;

    --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: linear-gradient(180deg, var(--pink-50) 0%, var(--pink-200) 50%, var(--pink-100) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Floral Decorations ---- */
.floral-decoration {
    position: fixed;
    width: 200px;
    height: 200px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
    background-size: contain;
    background-repeat: no-repeat;
}

.floral-top-left {
    top: -20px;
    left: -20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M30 170 Q60 100 120 80 Q80 60 100 10' stroke='%23C77D91' fill='none' stroke-width='2'/%3E%3Ccircle cx='100' cy='10' r='8' fill='%23E8A0B4'/%3E%3Ccircle cx='120' cy='80' r='6' fill='%23FFD6E0'/%3E%3Cpath d='M10 130 Q50 120 70 90' stroke='%23C77D91' fill='none' stroke-width='1.5'/%3E%3Ccircle cx='70' cy='90' r='5' fill='%23E8A0B4'/%3E%3C/svg%3E");
}

.floral-top-right {
    top: -20px;
    right: -20px;
    transform: scaleX(-1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M30 170 Q60 100 120 80 Q80 60 100 10' stroke='%23C77D91' fill='none' stroke-width='2'/%3E%3Ccircle cx='100' cy='10' r='8' fill='%23E8A0B4'/%3E%3Ccircle cx='120' cy='80' r='6' fill='%23FFD6E0'/%3E%3Cpath d='M10 130 Q50 120 70 90' stroke='%23C77D91' fill='none' stroke-width='1.5'/%3E%3Ccircle cx='70' cy='90' r='5' fill='%23E8A0B4'/%3E%3C/svg%3E");
}

.floral-bottom-left {
    bottom: -20px;
    left: -20px;
    transform: scaleY(-1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M30 170 Q60 100 120 80 Q80 60 100 10' stroke='%23C77D91' fill='none' stroke-width='2'/%3E%3Ccircle cx='100' cy='10' r='8' fill='%23E8A0B4'/%3E%3C/svg%3E");
}

.floral-bottom-right {
    bottom: -20px;
    right: -20px;
    transform: scale(-1, -1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M30 170 Q60 100 120 80 Q80 60 100 10' stroke='%23C77D91' fill='none' stroke-width='2'/%3E%3Ccircle cx='100' cy='10' r='8' fill='%23E8A0B4'/%3E%3C/svg%3E");
}

/* ---- Floating Petals ---- */
.petals-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.petal {
    position: absolute;
    top: -40px;
    animation: floatDown linear infinite;
    will-change: transform;
}

@keyframes floatDown {
    0% {
        transform: translateY(-40px) rotate(0deg) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg) translateX(80px);
        opacity: 0;
    }
}

/* ---- Main Container ---- */
.main-container {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ---- Hero Section ---- */
.hero {
    text-align: center;
    padding: 80px 0 40px;
    animation: fadeInUp 0.8s ease-out;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--pink-600);
    margin-bottom: 16px;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(36px, 8vw, 56px);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 20px;
}

.hero-title em {
    font-style: normal;
    color: var(--pink-600);
}

.divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 24px 0;
}

.divider::before,
.divider::after {
    content: '';
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--pink-400), transparent);
}

.divider-ornament {
    color: var(--pink-500);
    font-size: 18px;
    animation: pulse 3s ease-in-out infinite;
}

.hero-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 400px;
    margin: 0 auto;
}

/* ---- Search Section ---- */
.search-section {
    width: 100%;
    padding: 20px 0 40px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.search-container {
    width: 100%;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 4px;
    transition: all var(--transition-smooth);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-soft);
}

.search-box.focused {
    border-color: var(--pink-400);
    box-shadow: var(--shadow-medium), 0 0 0 4px rgba(232, 160, 180, 0.15);
    transform: translateY(-2px);
}

.search-box.has-value {
    border-color: var(--pink-500);
}

.search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: var(--pink-500);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 400;
    color: var(--text-primary);
    padding: 14px 8px;
    outline: none;
    width: 100%;
}

.search-input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

.search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--pink-100);
    border-radius: var(--radius-full);
    color: var(--pink-700);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-fast);
    flex-shrink: 0;
    margin-right: 4px;
}

.search-clear.visible {
    opacity: 1;
    transform: scale(1);
}

.search-clear:hover {
    background: var(--pink-200);
    transform: scale(1.05);
}

.search-clear:active {
    transform: scale(0.95);
}

/* ---- Results Section ---- */
.results-section {
    width: 100%;
    padding-bottom: 60px;
    min-height: 200px;
}

.loading-state,
.no-results,
.initial-state,
.results-container {
    display: none;
    text-align: center;
}

.loading-state.visible,
.no-results.visible,
.initial-state.visible,
.results-container.visible {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Loading Spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--pink-200);
    border-top-color: var(--pink-500);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin: 40px auto 16px;
}

.loading-state p {
    color: var(--text-muted);
    font-size: 14px;
}

/* No Results */
.no-results {
    padding: 40px 20px;
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.no-results h3 {
    font-family: var(--font-heading);
    font-size: 22px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.no-results p {
    color: var(--text-secondary);
    font-size: 14px;
    max-width: 300px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Initial State */
.initial-state {
    padding: 40px 20px;
}

.initial-icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: pulse 3s ease-in-out infinite;
}

.initial-state p {
    color: var(--text-muted);
    font-size: 15px;
}

/* Result Cards */
.result-card {
    margin-bottom: 16px;
    animation: slideInUp 0.5s ease-out both;
}

.result-card-inner {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    transition: all var(--transition-smooth);
}

.result-card-inner:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

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

.result-greeting {
    display: block;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--pink-600);
    margin-bottom: 4px;
}

.result-full-name {
    display: block;
    font-family: var(--font-heading);
    font-size: clamp(24px, 5vw, 32px);
    font-weight: 600;
    color: var(--text-primary);
}

.result-table {
    display: flex;
    justify-content: center;
}

.table-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--pink-100), var(--pink-200));
    border: 3px solid var(--pink-300);
    box-shadow: 0 8px 32px rgba(232, 160, 180, 0.2), inset 0 2px 8px rgba(255, 255, 255, 0.6);
    animation: badgePulse 2s ease-in-out infinite;
}

.table-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--pink-700);
    margin-bottom: 2px;
}

.table-number {
    font-family: var(--font-heading);
    font-size: 42px;
    font-weight: 700;
    color: var(--pink-800);
    line-height: 1.1;
}

.table-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--pink-600);
    margin-top: 2px;
}

/* ---- Language Switcher ---- */
.lang-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    gap: 4px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 4px;
    box-shadow: var(--shadow-soft);
}

.lang-btn {
    padding: 8px 14px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-btn:hover {
    color: var(--text-primary);
    background: var(--pink-50);
}

.lang-btn.active {
    background: var(--pink-200);
    color: var(--pink-800);
    font-weight: 600;
}

/* ---- Chinese Font Support ---- */
body.lang-zh {
    --font-heading: 'Noto Sans SC', 'Poppins', sans-serif;
}

body.lang-zh .hero-title em {
    font-style: normal;
}

body.lang-zh .search-input {
    font-family: 'Noto Sans SC', var(--font-body);
}

/* ---- Result Chinese Sub-name ---- */
.result-chinese-name {
    display: block;
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-family: 'Noto Sans SC', var(--font-body);
}

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.footer p {
    font-size: 13px;
    color: var(--pink-600);
    font-weight: 400;
    letter-spacing: 1px;
}

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes badgePulse {
    0%, 100% { 
        box-shadow: 0 8px 32px rgba(232, 160, 180, 0.2), inset 0 2px 8px rgba(255, 255, 255, 0.6);
    }
    50% { 
        box-shadow: 0 8px 40px rgba(232, 160, 180, 0.35), inset 0 2px 8px rgba(255, 255, 255, 0.8);
    }
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .main-container {
        padding: 0 16px;
    }

    .hero {
        padding: 60px 0 30px;
    }

    .hero-subtitle {
        font-size: 12px;
        letter-spacing: 2px;
    }

    .hero-description {
        font-size: 14px;
    }

    .search-input {
        font-size: 16px;
        padding: 12px 8px;
    }

    .result-card-inner {
        padding: 24px 20px;
    }

    .table-badge {
        width: 120px;
        height: 120px;
    }

    .table-number {
        font-size: 36px;
    }

    .floral-decoration {
        width: 120px;
        height: 120px;
    }
}

@media (min-width: 768px) {
    .result-card-inner {
        flex-direction: row;
        justify-content: space-between;
        padding: 36px 48px;
    }

    .result-name {
        text-align: left;
    }
}

/* ---- Prefers Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .petal {
        display: none;
    }
}
