/* 
  CSS Variables Setup
  Colors: Near-black bg, bone white text, dark blood red accent. 
*/
:root {
    --bg-color: #0a0a0b;
    --text-color: #f9f6f0;
    --text-muted: #a3a19d;
    --accent-color: #7a0303;
    --accent-hover: #520000;
    --border-color: #2a2a2c;
    --card-bg: rgba(18, 18, 20, 0.85);
    
    --font-heading: 'Crimson Pro', serif;
    --font-body: 'Inter', sans-serif;
}

/* Animations */
@keyframes smoothFadeIn {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.96);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

body {
    background-color: var(--bg-color);
    background-image: url('https://offertabs.s3.amazonaws.com/offer/c5ym4g/site/media/6a7b68dc561055.78198280.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Dark atmospheric vignette */
.vignette-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, transparent 30%, rgba(0, 0, 0, 0.8) 80%, rgba(0, 0, 0, 1) 100%);
    pointer-events: none;
    z-index: 0;
}

/* Photorealistic Fog Overlay using screen blend mode */
.fog-overlay {
    position: fixed;
    inset: 0;
    background-image: url('https://offertabs.s3.amazonaws.com/offer/c5ym4g/site/media/6a7b6db8c99674.62890989.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    mix-blend-mode: screen;
    opacity: 0.7;
    pointer-events: none;
    z-index: 1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 0.5em;
    color: var(--text-color);
}

h2 {
    font-size: 2rem;
}

/* Widget Wrapper */
.contest-widget {
    position: relative;
    z-index: 2; /* Sits above fog and vignette */
    width: 100%;
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    animation: smoothFadeIn 0.8s ease-out;
}

/* Tabs */
.contest-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 20px;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 1.125rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.tab-btn:hover {
    color: var(--text-color);
    background: rgba(255,255,255,0.05);
}

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

.tab-btn.active {
    background: rgba(40, 40, 45, 0.8);
    color: var(--text-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Content Container - Glassmorphism */
.tab-content {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* Animation applying to sections when they appear */
.tab-content:not(.hidden) {
    animation: fadeInScale 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Animation for dynamic nested content appearing (like success message or errors) */
.animate-in:not(.hidden) {
    animation: smoothFadeIn 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
}

.form-group:focus-within label {
    color: #e0e0e0;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 14px 16px;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 0 3px rgba(122, 3, 3, 0.2);
}

input::placeholder,
textarea::placeholder {
    color: #5a5a5c;
    transition: opacity 0.3s ease;
}

input:focus::placeholder,
textarea:focus::placeholder {
    opacity: 0.5;
}

/* File Upload custom style */
.file-upload-wrapper {
    position: relative;
    background: rgba(0, 0, 0, 0.6);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.3s ease, background 0.3s ease, transform 0.2s ease;
}

.file-upload-wrapper:hover {
    border-color: var(--text-muted);
    background: rgba(0, 0, 0, 0.8);
}

.file-upload-wrapper:active {
    transform: scale(0.99);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
}

.file-custom-text {
    color: var(--text-muted);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 24px;
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease, opacity 0.3s ease;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--text-color);
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(122, 3, 3, 0.4);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    box-shadow: 0 6px 16px rgba(122, 3, 3, 0.6);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(2px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

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

.btn-secondary:hover {
    background-color: rgba(255,255,255,0.08);
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

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

/* Smooth text swapping inside buttons */
.btn-text, .btn-loader {
    animation: smoothFadeIn 0.3s ease-out forwards;
}

/* Status & Errors */
.error-message {
    background: rgba(122, 3, 3, 0.15);
    border-left: 3px solid var(--accent-color);
    padding: 16px;
    margin-bottom: 24px;
    color: #ffb3b3;
    font-size: 0.95rem;
    border-radius: 0 6px 6px 0;
}

.post-submit-message {
    text-align: center;
    padding: 40px 20px;
}

.post-submit-message p {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 1.05rem;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    margin: 30px auto;
    width: 70%;
}

/* Gallery styles */
.gallery-header {
    text-align: center;
    margin-bottom: 40px;
}

.gallery-subtitle {
    color: var(--text-muted);
}

.voting-schedule {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    font-size: 0.85rem;
    color: var(--text-color);
    letter-spacing: 0.02em;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.gallery-item {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    animation: smoothFadeIn 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.gallery-image-wrapper {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #050505;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-item:hover .gallery-image {
    transform: scale(1.08);
}

.gallery-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.gallery-author {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-color);
}

.gallery-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vote-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 12px;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.vote-btn:hover:not(:disabled) {
    background: var(--accent-color);
    color: var(--text-color);
    box-shadow: 0 4px 10px rgba(122, 3, 3, 0.3);
    transform: translateY(-2px);
}

.vote-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.vote-btn:disabled {
    border-color: rgba(255,255,255,0.1);
    color: var(--text-muted);
    cursor: not-allowed;
    background: rgba(255,255,255,0.05);
    box-shadow: none;
}

.vote-btn.voted {
    background: rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.08);
    color: var(--text-muted);
}

.load-more-container {
    margin-top: 40px;
    text-align: center;
}

.gallery-loading, .gallery-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-style: italic;
}

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

#wbx-powered-by-slot {
    margin-top: 40px;
    padding-bottom: 40px;
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Responsive */
@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .tab-content {
        padding: 30px 20px;
    }
}
