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

:root {
    --color-cream: #FDF8F3;
    --color-rose: #E8C4C4;
    --color-rose-deep: #D4A5A5;
    --color-burgundy: #8B4D5C;
    --color-burgundy-dark: #6B3A47;
    --color-gold: #D4A853;
    --color-gold-light: #E8C97A;
    --color-text: #4A3540;
    --color-text-light: #7A6570;
    --color-white: #FFFFFF;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Quicksand', 'Segoe UI', sans-serif;

    --shadow-soft: 0 4px 20px rgba(139, 77, 92, 0.08);
    --shadow-medium: 0 8px 30px rgba(139, 77, 92, 0.12);
    --shadow-glow: 0 0 40px rgba(212, 168, 83, 0.2);

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 32px;

    --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-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--color-cream);
    min-height: 100vh;
    color: var(--color-text);
    overflow-x: hidden;
    position: relative;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(232, 196, 196, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(212, 168, 83, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(232, 196, 196, 0.2) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Floating Hearts Background */
.floating-hearts {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.floating-hearts span {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    background: var(--color-rose);
    opacity: 0.15;
    animation: float-up 15s linear infinite;
    clip-path: path('M10 18.35l-1.45-1.32C3.4 12.36 0 9.28 0 5.5 0 2.42 2.42 0 5.5 0 7.24 0 8.91.81 10 2.09 11.09.81 12.76 0 14.5 0 17.58 0 20 2.42 20 5.5c0 3.78-3.4 6.86-8.55 11.54L10 18.35z');
}

.floating-hearts span:nth-child(1) { left: 10%; animation-delay: 0s; width: 15px; height: 15px; }
.floating-hearts span:nth-child(2) { left: 20%; animation-delay: 2s; width: 25px; height: 25px; }
.floating-hearts span:nth-child(3) { left: 35%; animation-delay: 4s; }
.floating-hearts span:nth-child(4) { left: 50%; animation-delay: 1s; width: 18px; height: 18px; }
.floating-hearts span:nth-child(5) { left: 65%; animation-delay: 3s; width: 22px; height: 22px; }
.floating-hearts span:nth-child(6) { left: 80%; animation-delay: 5s; }
.floating-hearts span:nth-child(7) { left: 90%; animation-delay: 2.5s; width: 16px; height: 16px; }

@keyframes float-up {
    0% {
        transform: translateY(100vh) rotate(0deg) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.15;
    }
    100% {
        transform: translateY(-100px) rotate(360deg) scale(0.5);
        opacity: 0;
    }
}

/* Container */
.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 40px 24px 60px;
    animation: fadeInUp 0.8s ease-out;
}

.container.admin {
    max-width: 600px;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

header img.logo {
    width: 120px !important;
    max-width: 120px !important;
    height: auto !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-bottom: 16px !important;
    animation: fadeInUp 0.8s ease-out both;
    filter: drop-shadow(0 4px 12px rgba(139, 77, 92, 0.15));
}

header h1 {
    font-family: var(--font-display);
    font-size: 3.2rem;
    font-weight: 600;
    color: var(--color-burgundy);
    letter-spacing: 0.02em;
    margin-bottom: 12px;
    line-height: 1.1;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

header h1::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
    margin: 16px auto 0;
}

header .subtitle {
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--color-text-light);
    font-weight: 500;
    letter-spacing: 0.03em;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Cards */
.card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 28px 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(232, 196, 196, 0.3);
    animation: fadeInUp 0.6s ease-out both;
    transition: var(--transition-smooth);
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }

.card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.card h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-burgundy);
    margin-bottom: 20px;
    letter-spacing: 0.01em;
}

/* Messages */
.message {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 50px 32px;
    text-align: center;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(232, 196, 196, 0.3);
    animation: scaleIn 0.5s var(--transition-bounce) both;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.message h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-burgundy);
    margin-bottom: 12px;
}

.message p {
    color: var(--color-text-light);
    font-size: 1.05rem;
}

.heart-icon {
    font-size: 4rem;
    color: var(--color-rose-deep);
    margin-bottom: 20px;
    animation: heartbeat 1.5s ease-in-out infinite;
    display: inline-block;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.15); }
    30% { transform: scale(1); }
    45% { transform: scale(1.1); }
    60% { transform: scale(1); }
}

/* Contestant Cards */
.contestant-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(232, 196, 196, 0.25);
    transition: var(--transition-smooth);
    animation: slideInRight 0.5s ease-out both;
}

.contestant-card:nth-child(1) { animation-delay: 0.1s; }
.contestant-card:nth-child(2) { animation-delay: 0.15s; }
.contestant-card:nth-child(3) { animation-delay: 0.2s; }
.contestant-card:nth-child(4) { animation-delay: 0.25s; }
.contestant-card:nth-child(5) { animation-delay: 0.3s; }

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.contestant-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    border-color: var(--color-rose);
}

.contestant-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--color-text);
    letter-spacing: 0.01em;
}

/* Vote Button */
.vote-btn {
    background: linear-gradient(135deg, var(--color-burgundy) 0%, var(--color-burgundy-dark) 100%);
    color: var(--color-white);
    border: none;
    padding: 14px 32px;
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.vote-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: var(--transition-smooth);
}

.vote-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(139, 77, 92, 0.35);
}

.vote-btn:hover::before {
    left: 100%;
}

.vote-btn:active {
    transform: scale(0.98);
}

/* Form Elements */
.form-group {
    display: flex;
    gap: 12px;
}

.form-group input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid rgba(232, 196, 196, 0.4);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-white);
    transition: var(--transition-fast);
}

.form-group input::placeholder {
    color: var(--color-text-light);
    opacity: 0.7;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-burgundy);
    box-shadow: 0 0 0 4px rgba(139, 77, 92, 0.1);
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-transform: uppercase;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    background: linear-gradient(135deg, var(--color-burgundy) 0%, var(--color-burgundy-dark) 100%);
    color: var(--color-white);
}

.btn.primary:hover {
    box-shadow: 0 6px 20px rgba(139, 77, 92, 0.3);
}

.btn.secondary {
    background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-gold-light) 100%);
    color: var(--color-burgundy-dark);
}

.btn.secondary:hover {
    box-shadow: 0 6px 20px rgba(212, 168, 83, 0.35);
}

.btn.danger {
    background: var(--color-rose-deep);
    color: var(--color-white);
}

.btn.danger:hover {
    background: var(--color-burgundy);
    box-shadow: 0 6px 20px rgba(139, 77, 92, 0.25);
}

.btn.small {
    padding: 10px 18px;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* Contestant Items (Admin) */
.contestant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid rgba(232, 196, 196, 0.3);
    transition: var(--transition-fast);
}

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

.contestant-item:hover {
    padding-left: 8px;
}

.contestant-item span {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--color-text);
}

/* Results */
#results-container {
    margin-top: 24px;
    animation: fadeInUp 0.5s ease-out;
}

#total-votes {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--color-burgundy);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(232, 196, 196, 0.3);
    font-weight: 500;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid rgba(232, 196, 196, 0.2);
    animation: slideInRight 0.4s ease-out both;
}

.result-item:nth-child(1) { animation-delay: 0.1s; }
.result-item:nth-child(2) { animation-delay: 0.15s; }
.result-item:nth-child(3) { animation-delay: 0.2s; }

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

.medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.75rem;
    margin-right: 16px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.medal.gold {
    background: linear-gradient(135deg, #D4A853 0%, #F4D784 50%, #D4A853 100%);
    color: #5C4A1F;
    box-shadow: 0 4px 15px rgba(212, 168, 83, 0.4), var(--shadow-glow);
}

.medal.silver {
    background: linear-gradient(135deg, #A8A8A8 0%, #D4D4D4 50%, #A8A8A8 100%);
    color: #4A4A4A;
    box-shadow: 0 4px 15px rgba(168, 168, 168, 0.4);
}

.medal.bronze {
    background: linear-gradient(135deg, #B87333 0%, #DA9A5B 50%, #B87333 100%);
    color: #4A2F1A;
    box-shadow: 0 4px 15px rgba(184, 115, 51, 0.4);
}

.rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--color-text-light);
    margin-right: 16px;
    font-weight: 600;
    font-size: 1rem;
}

.result-item .name {
    flex: 1;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--color-text);
}

.result-item .votes {
    font-family: var(--font-body);
    color: var(--color-burgundy);
    font-weight: 600;
    font-size: 0.95rem;
    background: rgba(232, 196, 196, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
}

/* QR Code */
#qr-container {
    text-align: center;
    padding: 20px 0;
}

#qr-code {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
    margin-bottom: 16px;
}

#vote-url {
    font-family: var(--font-body);
    color: var(--color-text-light);
    font-size: 0.9rem;
    word-break: break-all;
    background: rgba(232, 196, 196, 0.2);
    padding: 10px 16px;
    border-radius: 8px;
    margin-top: 12px;
}

/* Utilities */
.hidden {
    display: none !important;
}

.error {
    color: var(--color-burgundy);
    font-size: 0.9rem;
    margin-top: 12px;
    font-weight: 500;
}

.muted {
    color: var(--color-text-light);
    font-style: italic;
    font-size: 0.95rem;
}

#loading {
    text-align: center;
    color: var(--color-text-light);
    font-size: 1.1rem;
    padding: 50px 20px;
    font-family: var(--font-display);
    font-style: italic;
}

#loading::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

#no-contestants {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 50px 32px;
    text-align: center;
    color: var(--color-text-light);
    font-family: var(--font-display);
    font-size: 1.1rem;
    box-shadow: var(--shadow-soft);
}

/* Responsive */
@media (max-width: 540px) {
    .container {
        padding: 30px 20px 50px;
    }

    header h1 {
        font-size: 2.5rem;
    }

    .form-group {
        flex-direction: column;
    }

    .form-group .btn {
        width: 100%;
    }

    .contestant-card {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        padding: 24px;
    }

    .vote-btn {
        width: 100%;
    }

    .card {
        padding: 24px 20px;
    }

    .result-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .result-item .votes {
        margin-left: 60px;
    }
}

/* Button group spacing */
.card .btn + .btn {
    margin-left: 10px;
}

@media (max-width: 540px) {
    .card .btn + .btn {
        margin-left: 0;
        margin-top: 10px;
    }

    .card .btn.secondary,
    .card .btn.danger {
        display: block;
        width: 100%;
    }
}
