:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #0ea5e9;
    --accent: #f43f5e;
    --bg-color: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --error: #ef4444;
    --success: #10b981;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

.hidden { display: none !important; }

/* Status Messages */
.status-message {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background-color: var(--surface);
}
.status-content h2 { font-size: 2.5rem; margin-bottom: 1rem; color: var(--primary); }
.status-content p { font-size: 1.25rem; color: var(--text-muted); }

/* Hero */
.hero {
    position: relative;
    padding: 100px 20px;
    background-size: cover;
    background-position: center;
    text-align: center;
    color: #fff;
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.9));
}
.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 800; margin-bottom: 1rem; }
.hero p { font-size: 1.25rem; opacity: 0.9; max-width: 600px; margin: 0 auto; }

/* Container */
.container {
    max-width: 1200px;
    margin: -40px auto 40px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

/* Tabs */
.tabs-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}
.tabs {
    display: inline-flex;
    background: var(--surface);
    padding: 0.5rem;
    border-radius: 999px;
    box-shadow: var(--shadow-md);
}
.tab-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}
.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }

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

/* Phase Banner */
.phase-banner {
    text-align: center;
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
    font-size: 1.05rem;
    animation: fadeIn 0.4s ease;
}
.phase-banner p { margin: 0; }
.phase-banner.active-phase {
    background-color: #e0e7ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}
.phase-banner.voting-phase {
    background-color: #fce7f3;
    color: #9d174d;
    border: 1px solid #fbcfe8;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    max-width: 700px;
    margin: 0 auto;
}
.card-header { text-align: center; margin-bottom: 2rem; }
.card-header h2 { font-size: 2rem; margin-bottom: 0.5rem; }
.card-header p { color: var(--text-muted); }

/* Form */
.form-group { margin-bottom: 1.5rem; }
.form-row { display: flex; gap: 1.5rem; }
.form-row .form-group { flex: 1; }
@media(max-width: 600px) { .form-row { flex-direction: column; gap: 0; } }

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}
input[type="text"], input[type="email"], input[type="tel"], textarea, select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    transition: all 0.2s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* File Upload */
.file-upload-wrapper {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: #f8fafc;
    transition: all 0.2s;
    cursor: pointer;
}
.file-upload-wrapper:hover { border-color: var(--primary); background: #f1f5f9; }
.file-upload-wrapper input[type="file"] {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer; z-index: 10;
}
.file-upload-ui { display: flex; flex-direction: column; align-items: center; gap: 1rem; pointer-events: none; }
.file-upload-ui svg { color: var(--text-muted); }
.file-upload-ui span { font-weight: 500; color: var(--text-muted); }
#file-ui-preview { pointer-events: auto; z-index: 20; position: relative; }
#image-preview { max-width: 100%; max-height: 300px; border-radius: 8px; object-fit: contain; box-shadow: var(--shadow-md); }

/* Buttons */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn-large { width: 100%; padding: 1rem; font-size: 1.125rem; margin-top: 1rem; }
.btn-small { padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.btn-secondary { background: white; color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-color); }

/* Loaders & Errors */
.loader {
    width: 24px; height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-message {
    background: #fef2f2; border: 1px solid #fecaca; color: var(--error);
    padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; text-align: center; font-weight: 500;
}

/* Success / Post-entry */
.success-header { text-align: center; margin-bottom: 2rem; }
.success-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; background: #d1fae5; color: var(--success); border-radius: 50%; margin-bottom: 1rem; }
.success-header h2 { font-size: 2rem; color: var(--success); }
.my-entry-preview { text-align: center; margin-bottom: 2rem; }
.my-entry-preview img { max-width: 100%; max-height: 300px; border-radius: 12px; box-shadow: var(--shadow-md); }
.share-panel { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; text-align: center; margin-bottom: 2rem; }
.share-link-group { display: flex; gap: 0.5rem; margin: 1rem 0; }
.share-link-group input { flex: 1; background: #fff; }
.social-share-buttons { display: flex; gap: 1rem; justify-content: center; }
.btn-social { padding: 0.75rem 1.5rem; border-radius: 8px; border: none; color: white; font-weight: 600; cursor: pointer; flex: 1; transition: opacity 0.2s; }
.btn-social:hover { opacity: 0.9; }
.btn-social.fb { background: #1877F2; }
.btn-social.tw { background: #000000; }
.success-actions { text-align: center; }

/* Gallery */
.gallery-controls { margin-bottom: 1.5rem; display: flex; justify-content: flex-end; }
.gallery-filter { display: flex; align-items: center; gap: 1rem; }
.gallery-filter select { width: 200px; background-color: var(--surface); }

.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state svg { margin-bottom: 1rem; color: var(--border); }
.empty-state h3 { font-family: 'Inter', sans-serif; color: var(--text-main); margin-bottom: 0.5rem; }
.empty-state button { margin-top: 1.5rem; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.gallery-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}
.gallery-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-img-wrap { aspect-ratio: 1; width: 100%; overflow: hidden; background: #f1f5f9; position: relative; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.gallery-card:hover .card-img-wrap img { transform: scale(1.05); }

.card-info { padding: 1rem; flex: 1; display: flex; flex-direction: column; }
.card-caption { font-size: 0.95rem; line-height: 1.4; color: var(--text-main); margin-bottom: 0.5rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-author { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; margin-top: auto; }

.btn-vote {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-vote:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-vote svg { transition: transform 0.2s; }
.btn-vote:hover:not(:disabled) svg { transform: scale(1.1); }
.btn-vote.voted { background: var(--accent); color: white; border-color: var(--accent); pointer-events: none; }
.btn-vote.voted svg { fill: white; }

.card-vote-wrap { position: absolute; top: 1rem; right: 1rem; z-index: 2; }

.load-more-container { text-align: center; margin-top: 3rem; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; }
.lightbox-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.9); backdrop-filter: blur(5px); }
.lightbox-content { position: relative; width: 100%; height: 100%; display: flex; z-index: 1001; }
@media(max-width: 900px) { .lightbox-content { flex-direction: column; } }

.lightbox-close { position: absolute; top: 1rem; right: 1rem; background: rgba(255,255,255,0.1); border: none; color: white; width: 40px; height: 40px; border-radius: 50%; font-size: 1.5rem; cursor: pointer; z-index: 1010; transition: background 0.2s; display: flex; align-items: center; justify-content: center; }
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

.lightbox-main { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; padding: 2rem; min-height: 50vh; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.1); border: none; color: white; width: 50px; height: 50px; border-radius: 50%; font-size: 2rem; cursor: pointer; transition: background 0.2s; display: flex; align-items: center; justify-content: center; padding-bottom: 4px; }
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-nav.prev { left: 1rem; }
.lightbox-nav.next { right: 1rem; }

.lightbox-image-container { position: relative; max-width: 100%; max-height: 100%; display: flex; align-items: center; justify-content: center; }
#lightbox-img { max-width: 100%; max-height: 85vh; object-fit: contain; box-shadow: 0 20px 40px rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.3s; }
#lightbox-img.loaded { opacity: 1; }

.lightbox-sidebar { width: 350px; background: var(--surface); padding: 2rem; display: flex; flex-direction: column; overflow-y: auto; }
@media(max-width: 900px) { .lightbox-sidebar { width: 100%; height: auto; max-height: 50vh; } .lightbox-main { padding: 3rem 1rem 1rem; } }

.lightbox-info { flex: 1; margin-bottom: 2rem; }
.lightbox-author { font-size: 1.25rem; margin-bottom: 1rem; }
.lightbox-caption { color: var(--text-muted); font-size: 1rem; line-height: 1.6; }

.lightbox-actions { border-top: 1px solid var(--border); padding-top: 1.5rem; }
.lightbox-vote { width: 100%; justify-content: center; padding: 1rem; font-size: 1rem; margin-bottom: 1.5rem; }
.lightbox-share .share-label { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.5rem; }
.share-buttons-small { display: flex; gap: 0.5rem; }
.btn-icon { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: white; color: var(--text-main); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; }
.btn-icon:hover { background: var(--bg-color); color: var(--primary); border-color: var(--primary); }

/* Body Lock */
body.lightbox-open { overflow: hidden; }

/* Powered by slot centering */
#wbx-powered-by-slot { margin: 2rem auto; text-align: center; width: 100%; max-width: 1200px; }