/* ==========================================================================
   SJDA People's Choice Award — Public Voting Gallery
   Luxury design system: Playfair Display + Inter, SG Red + Gold + Cream
   ========================================================================== */

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

:root {
    --sjda-red: #C8102E;
    --sjda-red-dark: #9B0D24;
    --sjda-gold: #D4AF37;
    --sjda-gold-soft: rgba(212, 175, 55, 0.15);
    --sjda-white: #FFFFFF;
    --sjda-cream: #FDF8F4;
    --sjda-charcoal: #1A1A1A;
    --sjda-text: #333333;
    --sjda-text-light: #888888;
    --sjda-border: #E8E4DF;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-body);
    background: var(--sjda-cream);
    color: var(--sjda-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sjda-border); border-radius: 3px; }

/* ============ HERO ============ */
.vote-hero {
    position: relative;
    text-align: center;
    padding: 3.5rem 1.5rem 2.5rem;
    background: linear-gradient(180deg, var(--sjda-charcoal) 0%, #2a1a1a 100%);
    color: var(--sjda-white);
    overflow: hidden;
}
.vote-hero::before {
    content: '✦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20rem;
    color: rgba(212, 175, 55, 0.04);
    pointer-events: none;
}

.hero-diamond {
    font-size: 2rem;
    color: var(--sjda-gold);
    margin-bottom: 0.75rem;
    display: block;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}
.hero-title span { color: var(--sjda-gold); }

.hero-subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: rgba(255,255,255,0.65);
    font-weight: 400;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ============ COUNTDOWN ============ */
.countdown-container {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}
.countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    min-width: 70px;
    backdrop-filter: blur(4px);
}
.countdown-unit .digit {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--sjda-white);
    line-height: 1;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.countdown-unit .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.45);
    margin-top: 0.25rem;
}
.countdown-separator {
    font-family: var(--font-display);
    font-size: 2rem;
    color: rgba(255,255,255,0.3);
    align-self: flex-start;
    padding-top: 0.75rem;
}

.countdown-closed {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--sjda-gold);
    margin-top: 1.5rem;
    font-style: italic;
}

/* ============ CONTROLS ============ */
.controls-bar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--sjda-white);
    border-bottom: 1px solid var(--sjda-border);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}
.sort-btn {
    background: transparent;
    border: 1.5px solid var(--sjda-border);
    border-radius: 100px;
    padding: 0.5rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sjda-text-light);
    cursor: pointer;
    transition: all 0.25s var(--transition);
    font-family: var(--font-body);
}
.sort-btn:hover { border-color: var(--sjda-red); color: var(--sjda-red); }
.sort-btn.active {
    background: var(--sjda-red);
    border-color: var(--sjda-red);
    color: var(--sjda-white);
}

.entries-count {
    font-size: 0.75rem;
    color: var(--sjda-text-light);
    display: flex;
    align-items: center;
    margin-left: 0.5rem;
}

/* ============ GRID ============ */
.entries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============ ENTRY CARD ============ */
.entry-card {
    background: var(--sjda-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.3s var(--transition), box-shadow 0.3s var(--transition);
    opacity: 0;
    transform: translateY(20px);
    animation: cardReveal 0.5s var(--transition) forwards;
}
.entry-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

@keyframes cardReveal {
    to { opacity: 1; transform: translateY(0); }
}

/* stagger via nth-child */
.entry-card:nth-child(1)  { animation-delay: 0.0s; }
.entry-card:nth-child(2)  { animation-delay: 0.05s; }
.entry-card:nth-child(3)  { animation-delay: 0.1s; }
.entry-card:nth-child(4)  { animation-delay: 0.15s; }
.entry-card:nth-child(5)  { animation-delay: 0.2s; }
.entry-card:nth-child(6)  { animation-delay: 0.25s; }
.entry-card:nth-child(n+7){ animation-delay: 0.3s; }

.card-image-wrap {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 square */
    background: #eee;
    overflow: hidden;
}
.card-image-wrap img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--transition);
}
.entry-card:hover .card-image-wrap img { transform: scale(1.03); }

.card-image-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 2rem 1rem 1rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: var(--sjda-white);
    opacity: 0;
    transition: opacity 0.3s;
}
.entry-card:hover .card-image-overlay { opacity: 1; }

.card-badges {
    position: absolute;
    top: 0.75rem; left: 0.75rem;
    display: flex;
    gap: 0.35rem;
    z-index: 2;
}
.card-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 4px;
}
.badge-winner { background: var(--sjda-gold); color: var(--sjda-charcoal); }
.badge-finalist { background: rgba(255,255,255,0.9); color: var(--sjda-charcoal); }
.badge-semifinalist { background: rgba(0,123,255,0.85); color: #fff; }

.card-category {
    position: absolute;
    top: 0.75rem; right: 0.75rem;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(0,0,0,0.5);
    color: var(--sjda-white);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.card-body {
    padding: 1rem 1.15rem 1.15rem;
}
.card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--sjda-charcoal);
    margin-bottom: 0.2rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-designer {
    font-size: 0.8rem;
    color: var(--sjda-text-light);
    margin-bottom: 0.75rem;
}

.card-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.vote-count-display {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.8rem;
}
.vote-count-display .total {
    font-weight: 700;
    color: var(--sjda-red);
}
.vote-count-display .breakdown {
    font-size: 0.7rem;
    color: var(--sjda-text-light);
}
.insta-likes {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    color: var(--sjda-text-light);
}
.insta-likes svg { width: 14px; height: 14px; }

.vote-btn-card {
    background: var(--sjda-red);
    color: var(--sjda-white);
    border: none;
    border-radius: 100px;
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}
.vote-btn-card:hover { background: var(--sjda-red-dark); transform: scale(1.02); }
.vote-btn-card:active { transform: scale(0.98); }

/* ============ DETAIL MODAL ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-container {
    background: var(--sjda-white);
    border-radius: var(--radius);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s var(--transition);
}
.modal-overlay.active .modal-container { transform: translateY(0); }

.modal-close {
    position: absolute;
    top: 1rem; right: 1rem;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: var(--sjda-white);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}
.modal-close:hover { background: rgba(0,0,0,0.8); }

.modal-layout {
    display: flex;
    min-height: 400px;
}
.modal-image {
    flex: 1;
    min-height: 350px;
    position: relative;
    background: #eee;
    overflow: hidden;
}
.modal-image img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.modal-details {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}
.modal-details .detail-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sjda-red);
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.modal-details .detail-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sjda-charcoal);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}
.modal-details .detail-designer {
    font-size: 0.9rem;
    color: var(--sjda-text-light);
    margin-bottom: 1rem;
}
.modal-details .detail-description {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--sjda-text);
    margin-bottom: 1.25rem;
    flex: 1;
}
.modal-details .detail-votes {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--sjda-border);
    border-bottom: 1px solid var(--sjda-border);
}
.vote-stat {
    display: flex;
    flex-direction: column;
}
.vote-stat .num {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sjda-red);
}
.vote-stat .lbl {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sjda-text-light);
}
.vote-stat.insta .num { color: #E1306C; }

.modal-details .view-entry-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--sjda-red);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: gap 0.2s;
}
.modal-details .view-entry-link:hover { gap: 0.5rem; }

/* Vote form */
.vote-form-section {
    border-top: 1px solid var(--sjda-border);
    padding-top: 1.25rem;
}
.vote-form-section h4 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--sjda-charcoal);
}
.vote-form .form-group {
    margin-bottom: 0.6rem;
}
.vote-form label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sjda-text-light);
    display: block;
    margin-bottom: 0.2rem;
}
.vote-form input, .vote-form textarea {
    width: 100%;
    border: 1.5px solid var(--sjda-border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    font-family: var(--font-body);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--sjda-white);
}
.vote-form input:focus, .vote-form textarea:focus {
    outline: none;
    border-color: var(--sjda-red);
    box-shadow: 0 0 0 3px rgba(200,16,46,0.1);
}
.vote-form textarea { resize: vertical; min-height: 60px; }

/* Honeypot - hidden from real users */
.vote-form .hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; }

.vote-submit-btn {
    width: 100%;
    background: var(--sjda-red);
    color: var(--sjda-white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.7rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    margin-top: 0.5rem;
}
.vote-submit-btn:hover { background: var(--sjda-red-dark); }
.vote-submit-btn:active { transform: scale(0.98); }
.vote-submit-btn:disabled {
    background: var(--sjda-border);
    color: var(--sjda-text-light);
    cursor: not-allowed;
}

.vote-message {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.5;
    display: none;
}
.vote-message.success { display: block; background: #d4edda; color: #155724; }
.vote-message.error { display: block; background: #f8d7da; color: #721c24; }
.vote-message.pending { display: block; background: #fff3cd; color: #856404; }

/* Social share */
.share-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--sjda-border);
}
.share-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sjda-text-light);
    margin-bottom: 0.6rem;
}
.share-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 100px;
    border: 1.5px solid var(--sjda-border);
    background: var(--sjda-white);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--sjda-text);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: var(--font-body);
}
.share-btn:hover { border-color: var(--sjda-red); color: var(--sjda-red); }
.share-btn svg { width: 16px; height: 16px; }
.share-btn.copied { background: #d4edda; border-color: #28a745; color: #155724; }

/* ============ FOOTER ============ */
.vote-footer {
    text-align: center;
    padding: 2.5rem 1.5rem;
    border-top: 1px solid var(--sjda-border);
    margin-top: 2rem;
}
.vote-footer .footer-logo {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--sjda-charcoal);
    margin-bottom: 0.35rem;
}
.vote-footer .footer-logo span { color: var(--sjda-gold); }
.vote-footer .footer-text {
    font-size: 0.75rem;
    color: var(--sjda-text-light);
}
.vote-footer .footer-links {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}
.vote-footer .footer-links a {
    font-size: 0.75rem;
    color: var(--sjda-text-light);
    text-decoration: none;
}
.vote-footer .footer-links a:hover { color: var(--sjda-red); }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .vote-hero { padding: 2.5rem 1rem 2rem; }
    .hero-title { font-size: 1.5rem; }
    .countdown-unit { min-width: 55px; padding: 0.5rem 0.6rem; }
    .countdown-unit .digit { font-size: 1.5rem; }
    .entries-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    .modal-container { max-height: 95vh; }
    .modal-layout { flex-direction: column; }
    .modal-image { min-height: 250px; max-height: 300px; }
    .modal-details { padding: 1.25rem; }
    .modal-details .detail-title { font-size: 1.25rem; }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .entries-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1025px) {
    .entries-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============ ANIMATIONS ============ */
@keyframes pulseRed {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200, 16, 46, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(200, 16, 46, 0); }
}
.vote-btn-card.pulse { animation: pulseRed 1.5s ease 1; }

/* Vote count roll-up */
.vote-count-display .total {
    transition: transform 0.3s var(--transition);
}
