:root {
    /* Brand Colors */
    --primary: #f97316; /* Halloween Orange */
    --primary-dark: #ea580c;
    --secondary: #8b5cf6; /* Halloween Purple */
    --secondary-dark: #7c3aed;
    
    /* Dark Theme Core */
    --bg-dark: #0f111a;
    --bg-card: rgba(30, 33, 48, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Text Colors */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Utilities */
    --radius: 12px;
    --shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 800; line-height: 1.2; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.flex { display: flex; }
.justify-center { justify-content: center; }
.gap-4 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }

.hidden { display: none !important; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.btn:disabled { opacity: 0.7; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-large { padding: 1rem 2rem; font-size: 1.1rem; }
.btn-block { display: block; width: 100%; }

/* Social Buttons */
.btn-icon { padding: 0.75rem 1.5rem; font-weight: 500; }
.fb-color { background-color: #1877f2; color: #fff; }
.fb-color:hover { background-color: #166fe5; }
.tw-color { background-color: #000; color: #fff; border: 1px solid #333; }
.tw-color:hover { background-color: #111; }

/* Layout Components */
.main-container {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
    display: flex;
    flex-direction: column;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Hero Section */
.hero {
    position: relative;
    padding: 80px 20px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 400px;
    margin-bottom: 2rem;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(15, 17, 26, 0.6) 0%, rgba(15, 17, 26, 1) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
}

.hero .badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(249, 115, 22, 0.2);
    border: 1px solid rgba(249, 115, 22, 0.5);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
}

.hero-title {
    font-size: 3.5rem;
    color: #fff;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 10;
}

.tab-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 1rem 2rem;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

/* Forms */
.form-card { max-width: 600px; margin: 0 auto; width: 100%; }

.form-header { text-align: center; margin-bottom: 2rem; }
.form-header h2 { font-size: 2rem; margin-bottom: 0.5rem; color: #fff; }
.form-header p { color: var(--text-muted); }

.form-group { margin-bottom: 1.5rem; text-align: left; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-group.half { flex: 1; min-width: calc(50% - 0.5rem); }

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: #e2e8f0;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

.form-control::placeholder { color: #64748b; }

select.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}
select.form-control option { background-color: var(--bg-dark); color: #fff; }

/* File Upload */
.file-upload-wrapper { position: relative; width: 100%; }
.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}
.file-upload-label:hover {
    border-color: var(--primary);
    background: rgba(249, 115, 22, 0.05);
}
.upload-icon { color: var(--text-muted); margin-bottom: 1rem; transition: color 0.3s; }
.file-upload-label:hover .upload-icon { color: var(--primary); }
.upload-text { font-size: 1rem; color: var(--text-muted); font-weight: 500; }

.preview-area { margin-top: 1rem; border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--border-color); }
.preview-area img { max-width: 100%; max-height: 300px; display: block; margin: 0 auto; object-fit: contain; }


/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    font-weight: 500;
}
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.alert-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: #86efac; }
.alert-info { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); color: #93c5fd; }
.alert-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #fcd34d; }


/* Post Entry */
.post-entry-card { max-width: 600px; margin: 0 auto; }
.success-icon {
    width: 64px; height: 64px;
    margin: 0 auto;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.share-panel {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
}
.share-input-group { display: flex; gap: 0.5rem; }
.share-input-group input { flex: 1; }


/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.gallery-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: rgba(255,255,255,0.2);
}

.gallery-img-container {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    background-color: #000;
    background-size: cover;
    background-position: center;
}

/* Ballot Badge in Grid */
.ballot-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 2;
}

.view-btn {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    color: white;
    font-weight: 600;
    border: none;
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    z-index: 1;
}

.gallery-img-container:hover .view-btn {
    opacity: 1;
}

.gallery-info {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.gallery-caption {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.gallery-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 1.1rem;
}


/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lightbox-content {
    position: relative;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

.lightbox-close:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.lightbox-img-wrapper {
    background: #000;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-caption {
    padding: 1.5rem;
    font-size: 1.1rem;
    color: #fff;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

/* Ballot Badge in Lightbox */
.lightbox-ballot {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 10;
}


/* Footer Powered By */
#wbx-powered-by-slot {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    width: 100%;
}


/* Responsive */
@media (max-width: 768px) {
    .hero { padding: 60px 20px; min-height: 300px; }
    .hero-title { font-size: 2.5rem; }
    .form-group.half { min-width: 100%; }
    .tabs { flex-direction: column; padding: 0 20px; }
    .tab-btn { width: 100%; text-align: center; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .lightbox { padding: 1rem; }
    .lightbox-img-wrapper { height: 50vh; }
}