/* --- Global Styles & Variables --- */
:root {
    --bg-color: #121212;
    --primary-orange: #FF8C00;
    --accent-green: #00FF7F;
    --text-color: #E0E0E0;
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Roboto Mono', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    overflow-x: hidden;
}

.main-container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

/* --- Phase Handling --- */
.phase {
    display: none; /* Hide all phases by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    animation: fadeIn 1.5s ease-in-out;
}

.phase.active {
    display: flex; /* Show only the active phase */
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* --- Shared Elements --- */
.title {
    font-family: var(--font-display);
    color: var(--primary-orange);
    font-size: 2.5rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--primary-orange);
}

.subtitle {
    font-family: var(--font-display);
    color: var(--accent-green);
    font-size: 1.2rem;
    margin-top: 10px;
    margin-bottom: 30px;
    text-shadow: 0 0 5px var(--accent-green);
}

.photo-placeholder {
    border: 3px solid var(--accent-green);
    border-radius: 50%;
    margin-bottom: 20px;
    width: 250px;
    height: 250px;
    object-fit: cover;
    box-shadow: 0 0 15px var(--accent-green);
}

.photo-placeholder.small {
    width: 150px;
    height: 150px;
}


/* --- Phase 1: Pre-Event --- */
#phase-pre-event .phase-content {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.phase-content {
    width: 100%;
}

.countdown-timer {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.timer-unit {
    display: flex;
    flex-direction: column;
}

.timer-unit span {
    font-family: var(--font-display);
    font-size: 3.5rem;
    color: var(--text-color);
    line-height: 1;
    animation: pulse 2s infinite ease-in-out;
}

.timer-unit label {
    font-size: 0.8rem;
    color: var(--accent-green);
    text-transform: uppercase;
}

.tagline {
    margin-top: 20px;
    font-style: italic;
    color: #aaa;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* --- Phase 2: During Event --- */
#phase-during-event h3 {
    font-family: var(--font-display);
    color: var(--primary-orange);
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--accent-green);
    padding-bottom: 5px;
}

.progress-bar-container {
    width: 100%;
    margin-top: 20px;
}
.progress-bar-container label {
    font-size: 0.9rem;
    display: block;
    margin-bottom: 5px;
}
progress {
    width: 100%;
    height: 20px;
    -webkit-appearance: none;
    appearance: none;
}
progress::-webkit-progress-bar {
    background-color: #333;
    border-radius: 5px;
}
progress::-webkit-progress-value {
    background-color: var(--accent-green);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.interactive-card {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--accent-green);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.interactive-button {
    background: none;
    border: 1px solid var(--primary-orange);
    color: var(--primary-orange);
    padding: 10px 15px;
    font-family: var(--font-body);
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.3s, color 0.3s;
}

.interactive-button:hover {
    background-color: var(--primary-orange);
    color: var(--bg-color);
}

.hidden-content {
    display: none;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #ccc;
    animation: fadeIn 0.5s;
}

.hidden-content.visible {
    display: block;
}

/* --- Phase 3: Post-Event --- */
.thank-you-message {
    font-size: 1.1rem;
    margin: 20px 0;
}

.placeholder-section {
    width: 100%;
    margin-top: 30px;
    padding: 20px;
    border: 1px dashed var(--accent-green);
    border-radius: 8px;
}

.placeholder-section h3 {
    font-family: var(--font-display);
    color: var(--primary-orange);
    margin-bottom: 15px;
}

.cta-button {
    display: inline-block;
    background-color: var(--primary-orange);
    color: var(--bg-color);
    padding: 12px 25px;
    text-decoration: none;
    font-weight: bold;
    border-radius: 5px;
    margin-top: 15px;
    transition: transform 0.2s;
    border: none;
    cursor: pointer;
}

.cta-button:hover {
    transform: scale(1.05);
}

textarea {
    width: 100%;
    background-color: #222;
    border: 1px solid var(--accent-green);
    color: var(--text-color);
    padding: 10px;
    border-radius: 5px;
    font-family: var(--font-body);
    margin-top: 10px;
}

/* --- Comments Section --- */
#comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
}

#comment-name {
    width: 100%;
    background-color: #222;
    border: 1px solid var(--accent-green);
    color: var(--text-color);
    padding: 10px;
    border-radius: 5px;
    font-family: var(--font-body);
    font-size: 1rem;
}

#comment-name:focus,
#comment-message:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 5px var(--primary-orange);
}

#comments-container {
    margin-top: 30px;
}

#comments-container h4 {
    font-family: var(--font-display);
    color: var(--accent-green);
    margin-bottom: 20px;
    text-align: left;
    font-size: 1.2rem;
}

#comments-list {
    text-align: left;
}

.comment {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 255, 127, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    animation: fadeIn 0.5s ease-in-out;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.comment-author {
    color: var(--primary-orange);
    font-family: var(--font-display);
    font-size: 1rem;
}

.comment-date {
    color: #888;
    font-size: 0.8rem;
    font-family: var(--font-body);
}

.comment-message {
    color: var(--text-color);
    line-height: 1.5;
    word-wrap: break-word;
}

.no-comments {
    text-align: center;
    color: #888;
    font-style: italic;
    margin: 20px 0;
}

button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

button[disabled]:hover {
    transform: none;
}

/* --- Music Player Section --- */
.music-section {
    width: 100%;
    margin: 30px 0;
    padding: 25px;
    border: 2px solid var(--accent-green);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 255, 127, 0.05), rgba(255, 140, 0, 0.05));
    text-align: center;
    position: relative;
    overflow: hidden;
}

.music-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(0, 255, 127, 0.1),
        transparent
    );
    animation: musicGlow 3s infinite;
    pointer-events: none;
}

@keyframes musicGlow {
    0%, 100% { transform: rotate(0deg); opacity: 0; }
    50% { transform: rotate(180deg); opacity: 1; }
}

.music-section h3 {
    font-family: var(--font-display);
    color: var(--primary-orange);
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--primary-orange);
    position: relative;
    z-index: 1;
}

.music-section p {
    color: #ccc;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.music-button {
    background: linear-gradient(45deg, var(--primary-orange), #FF6500);
    border: 3px solid var(--accent-green);
    color: var(--bg-color);
    padding: 15px 30px;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 
        0 0 20px rgba(255, 140, 0, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.music-button:hover {
    transform: scale(1.1);
    box-shadow: 
        0 0 30px rgba(255, 140, 0, 0.6),
        0 0 50px rgba(0, 255, 127, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
    background: linear-gradient(45deg, #FF6500, var(--primary-orange));
}

.music-button:active {
    transform: scale(1.05);
}

.music-button.playing {
    animation: musicPulse 1s infinite;
    background: linear-gradient(45deg, var(--accent-green), #00CC66);
    border-color: var(--primary-orange);
}

@keyframes musicPulse {
    0%, 100% { 
        box-shadow: 
            0 0 20px rgba(0, 255, 127, 0.6),
            0 0 40px rgba(0, 255, 127, 0.4);
    }
    50% { 
        box-shadow: 
            0 0 30px rgba(0, 255, 127, 0.8),
            0 0 60px rgba(0, 255, 127, 0.6);
    }
}

.music-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.music-button.playing .music-icon {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.music-text {
    transition: all 0.3s ease;
}

/* --- Image Gallery Section --- */
.gallery-section {
    width: 100%;
    margin-top: 30px;
    padding: 20px;
    border: 1px dashed var(--accent-green);
    border-radius: 8px;
}

.gallery-section h3 {
    font-family: var(--font-display);
    color: var(--primary-orange);
    margin-bottom: 15px;
}

.gallery-section p {
    margin-bottom: 25px;
    color: #ccc;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

@media (min-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background: linear-gradient(45deg, rgba(0, 255, 127, 0.1), rgba(255, 140, 0, 0.1));
}

.image-item:hover,
.image-item:focus {
    transform: scale(1.05);
    border-color: var(--accent-green);
    box-shadow: 
        0 0 20px rgba(0, 255, 127, 0.4),
        0 0 40px rgba(0, 255, 127, 0.2),
        inset 0 0 20px rgba(0, 255, 127, 0.1);
    outline: none;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    /* Optimize for faster loading and smaller display */
    image-rendering: auto;
    max-width: 300px;
    max-height: 300px;
    /* Reduce quality for preview */
    filter: contrast(0.95) brightness(1.02);
}

.image-item:hover img {
    transform: scale(1.1);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        rgba(0, 255, 127, 0) 0%,
        rgba(0, 255, 127, 0.2) 50%,
        rgba(255, 140, 0, 0.2) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-item:hover .image-overlay,
.image-item:focus .image-overlay {
    opacity: 1;
}

.zoom-icon {
    font-size: 2rem;
    color: white;
    text-shadow: 0 0 10px rgba(0, 255, 127, 0.8);
    animation: pulse 2s infinite;
}

.gallery-cta {
    margin-top: 15px;
}

/* Gallery Loading State */
.gallery-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    grid-column: 1 / -1; /* Span all columns */
}

.gallery-loading .loader-spinner {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(0, 255, 127, 0.3);
    border-top: 2px solid var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.gallery-loading p {
    color: var(--accent-green);
    font-family: var(--font-display);
    margin: 0;
    font-size: 0.9rem;
}

/* --- PRO Gallery Section --- */
.pro-gallery {
    border: 2px solid var(--primary-orange);
    background: linear-gradient(135deg, rgba(255, 140, 0, 0.05), rgba(0, 255, 127, 0.05));
}

.pro-gallery h3 {
    color: var(--primary-orange);
    text-shadow: 0 0 10px var(--primary-orange);
}

/* --- Lightbox Modal --- */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-modal.active {
    display: flex;
    opacity: 1;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox-modal.active .lightbox-content {
    transform: scale(1);
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(0, 255, 127, 0.3);
}

.lightbox-header h3 {
    font-family: var(--font-display);
    color: var(--primary-orange);
    margin: 0;
    text-shadow: 0 0 10px var(--primary-orange);
}

.lightbox-close {
    background: none;
    border: 2px solid var(--accent-green);
    color: var(--accent-green);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: var(--accent-green);
    color: var(--bg-color);
    box-shadow: 0 0 15px var(--accent-green);
    transform: rotate(90deg);
}

.lightbox-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.lightbox-image-container {
    position: relative;
    width: 90%;
    height: calc(100vh - 180px); /* More space for header and counter */
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 
        0 0 30px rgba(0, 255, 127, 0.3),
        0 0 60px rgba(0, 255, 127, 0.1);
    transition: opacity 0.3s ease;
}

.lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--accent-green);
    font-family: var(--font-display);
    font-size: 1.1rem;
    text-shadow: 0 0 5px var(--accent-green);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 255, 127, 0.1);
    border: 2px solid var(--accent-green);
    color: var(--accent-green);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.lightbox-nav:hover {
    background: var(--accent-green);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--accent-green);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lightbox-nav:disabled:hover {
    background: rgba(0, 255, 127, 0.1);
    color: var(--accent-green);
    transform: translateY(-50%) scale(1);
    box-shadow: none;
}

/* Lightbox Loader */
.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background: rgba(18, 18, 18, 0.9);
    padding: 30px;
    border-radius: 10px;
    border: 1px solid var(--accent-green);
}

.lightbox-loader.hidden {
    display: none;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 255, 127, 0.3);
    border-top: 3px solid var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.lightbox-loader p {
    color: var(--accent-green);
    font-family: var(--font-display);
    font-size: 1rem;
    margin: 0;
    text-shadow: 0 0 5px var(--accent-green);
}

/* Mobile optimizations for lightbox */
@media (max-width: 768px) {
    .lightbox-header {
        padding: 15px;
    }
    
    .lightbox-body {
        padding: 15px;
    }
    
    .lightbox-image-container {
        width: 95%;
        height: calc(100vh - 160px); /* More space for counter on mobile */
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-counter {
        bottom: -30px;
        font-size: 1rem;
    }
}

/* --- Floating Bobr Animation --- */
.floating-bobr {
    position: fixed;
    width: 120px;
    height: 120px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.5) rotate(-15deg);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    filter: drop-shadow(0 0 10px var(--accent-green));
}

.floating-bobr.visible {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.floating-bobr img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: bobrFloat 1s ease-in-out infinite alternate;
}

@keyframes bobrFloat {
    0% { 
        transform: translateY(0px) rotate(0deg) scale(1);
    }
    25% { 
        transform: translateY(-3px) rotate(2deg) scale(1.02);
    }
    50% { 
        transform: translateY(-2px) rotate(-1deg) scale(1.01);
    }
    75% { 
        transform: translateY(-4px) rotate(3deg) scale(1.03);
    }
    100% { 
        transform: translateY(-5px) rotate(-1deg) scale(1.04);
    }
}

/* Corner entry animations only */
.floating-bobr.from-top-left {
    top: 20px;
    left: 20px;
    animation: slideInTopLeft 3s ease-out;
}

.floating-bobr.from-top-right {
    top: 20px;
    right: 20px;
    animation: slideInTopRight 3s ease-out;
}

.floating-bobr.from-bottom-left {
    bottom: 20px;
    left: 20px;
    animation: slideInBottomLeft 3s ease-out;
}

.floating-bobr.from-bottom-right {
    bottom: 20px;
    right: 20px;
    animation: slideInBottomRight 3s ease-out;
}

@keyframes slideInTopLeft {
    0% { 
        transform: translate(-120px, -120px) rotate(-45deg) scale(0.5);
        opacity: 0;
    }
    20% { 
        transform: translate(0px, 0px) rotate(5deg) scale(1.1);
        opacity: 1;
    }
    80% { 
        transform: translate(0px, 0px) rotate(-3deg) scale(1);
        opacity: 1;
    }
    100% { 
        transform: translate(0px, 0px) rotate(-3deg) scale(0);
        opacity: 0;
    }
}

@keyframes slideInTopRight {
    0% { 
        transform: translate(120px, -120px) rotate(45deg) scale(0.5);
        opacity: 0;
    }
    20% { 
        transform: translate(0px, 0px) rotate(-5deg) scale(1.1);
        opacity: 1;
    }
    80% { 
        transform: translate(0px, 0px) rotate(3deg) scale(1);
        opacity: 1;
    }
    100% { 
        transform: translate(0px, 0px) rotate(3deg) scale(0);
        opacity: 0;
    }
}

@keyframes slideInBottomLeft {
    0% { 
        transform: translate(-120px, 120px) rotate(-135deg) scale(0.5);
        opacity: 0;
    }
    20% { 
        transform: translate(0px, 0px) rotate(5deg) scale(1.1);
        opacity: 1;
    }
    80% { 
        transform: translate(0px, 0px) rotate(-3deg) scale(1);
        opacity: 1;
    }
    100% { 
        transform: translate(0px, 0px) rotate(-3deg) scale(0);
        opacity: 0;
    }
}

@keyframes slideInBottomRight {
    0% { 
        transform: translate(120px, 120px) rotate(135deg) scale(0.5);
        opacity: 0;
    }
    20% { 
        transform: translate(0px, 0px) rotate(-5deg) scale(1.1);
        opacity: 1;
    }
    80% { 
        transform: translate(0px, 0px) rotate(3deg) scale(1);
        opacity: 1;
    }
    100% { 
        transform: translate(0px, 0px) rotate(3deg) scale(0);
        opacity: 0;
    }
}

/* Extra sparkle effect */
.floating-bobr::before {
    content: '✨';
    position: absolute;
    top: -20px;
    right: -15px;
    font-size: 20px;
    animation: sparkle 0.8s ease-in-out infinite alternate;
}

.floating-bobr::after {
    content: '🦫';
    position: absolute;
    bottom: -25px;
    left: -20px;
    font-size: 16px;
    animation: sparkle 1.2s ease-in-out infinite alternate-reverse;
}

@keyframes sparkle {
    0% { 
        transform: scale(0.5) rotate(0deg);
        opacity: 0.5;
    }
    100% { 
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }
}

/* --- Responsiveness --- */
@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }
    .subtitle {
        font-size: 1rem;
    }
    .timer-unit span {
        font-size: 2.5rem;
    }
    .photo-placeholder {
        width: 180px;
        height: 180px;
    }
    .photo-placeholder.small {
        width: 120px;
        height: 120px;
    }
    
    /* Adjusted bobr size on mobile */
    .floating-bobr {
        width: 90px;
        height: 90px;
    }
    
    .floating-bobr::before {
        font-size: 16px;
        top: -15px;
        right: -10px;
    }
    
    .floating-bobr::after {
        font-size: 12px;
        bottom: -20px;
        left: -15px;
    }
}