/* === CSS Variables === */
:root {
    --bg-color: #0a0a0a;
    --text-color: #00ff00;
    --accent-color: #ff00ff;
}

/* === Base Styles === */
html, body {
    margin: 0;
    padding: 0;
    font-family: 'Courier New', monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100%;
    width: 100%;
    overscroll-behavior: none;
    user-select: none;
    touch-action: none;
    overflow: hidden;
    cursor: url('FU-Cursor.png'), auto;
}

@media (orientation: portrait) {
    body {
        max-height: 100vh;
    }
}

@media (orientation: landscape) {
    body {
        max-height: 100vw;
    }
}

/* Button cursor styles */
button.button,
a.button,
#generateLink,
.camera-btn.button,
.help-btn.button,
.share-btn.button {
    cursor: url('peen.png'), pointer !important;
    z-index: 2000;
}

/* === Layout Components === */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* === Typography === */
h1 {
    font-family: 'Pirata One', cursive;
    font-size: 4rem;
    color: #FFD700;
    text-shadow: 2px 2px 4px #000000, 0 0 20px #FF0000, 0 0 30px #FF0000;
    letter-spacing: 2px;
    text-align: center;
}

/* === Button Base Styles === */
.button, #generateLink {
    cursor: url('peen.png'), pointer !important;
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid #00ff00;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 16px;
    border-radius: 5px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    padding: 12px 24px;
    z-index: 1000;
    text-decoration: none;
    animation: popupPulse 1s infinite;
}

.button svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    display: block;
}

.button:hover, #generateLink:hover {
    background: rgba(0, 255, 0, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
    transform: translateY(-2px);
    text-decoration: none;
}

/* === Hamburger Menu Button === */
.menu-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.menu-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    display: block;
    pointer-events: none;
}

/* === Dropdown Menu === */
.menu-dropdown {
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    position: fixed;
    top: 75px;
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #00ff00;
    border-radius: 5px;
    z-index: 2000;
    min-width: 180px;
    backdrop-filter: blur(5px);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.menu-dropdown.show {
    display: block;
    opacity: 1;
    visibility: visible;
}

.dropdown-item {
    display: block;
    padding: 12px 15px;
    color: #00ff00;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
    cursor: url('peen.png'), pointer;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(0, 255, 0, 0.1);
    color: #ff00ff;
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

@media (max-width: 768px) {
    .menu-btn {
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
        padding: 8px;
    }
    
    .menu-dropdown {
        top: 60px;
        left: 10px;
        min-width: 150px;
    }
    
    .dropdown-item {
        padding: 10px;
        font-size: 14px;
    }
}

/* === Fixed Position Elements === */
.system-log-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    text-decoration: none;
}

.help-btn {
    position: fixed;
    top: 20px;
    right: 237px;
    width: 45px;
    height: 45px;
    font-size: 24px;
}

.share-btn {
    position: fixed;
    top: 20px;
    right: 180px;
    width: 45px;
    height: 45px;
}

.camera-btn.button {
    position: fixed;
    top: 20px;
    right: 294px;
    width: 45px;
    height: 45px;
    margin: 0;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
}

/* Shared styles for icon buttons */
.share-btn, .camera-btn, .help-btn {
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn svg, .camera-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    display: block;
    pointer-events: none;
}

#visit-counter {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
}

#bouncing-image {
    position: fixed;
    z-index: 10;
    pointer-events: none;
    width: 150px;
    height: auto;
}

/* === Modal Styles === */
.modal, .gallery-modal, .photo-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    overflow: auto;
}

.gallery-modal, .photo-modal {
    z-index: 2001;
    display: none;
    -webkit-overflow-scrolling: touch;
}

.modal-content, .gallery-content {
    position: relative;
    background-color: var(--bg-color);
    border: 2px solid #00ff00;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
}

.modal-content {
    margin: 15% auto;
    padding: 20px;
    width: 80%;
    max-width: 500px;
    touch-action: none;
    cursor: move;
}

/* === Gallery Grid === */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* === Gallery Items === */
.gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border: 2px solid #00ff00;
    border-radius: 5px;
    transition: all 0.3s ease;
    animation: popupPulse 1s infinite;
    background: rgba(0, 0, 0, 0.95);
}

.gallery-item:hover {
    border-color: #ff00ff;
    transform: scale(1.05);
    z-index: 1;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

/* === Gallery Info Overlay === */
.gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    padding: 10px;
    color: #00ff00;
    font-size: 12px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 6;
}

.gallery-item:hover .gallery-info {
    transform: translateY(0);
}

/* === Video Container === */
.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    z-index: 2;
}

.video-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* === Video Element === */

.gallery-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    opacity: 1;
    transition: opacity 0.3s ease;
    display: block;
    z-index: 1;
}

.gallery-video:not([src]) {
    visibility: hidden;
}

/* === Loading Spinner === */
.video-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 255, 0, 0.3);
    border-top-color: #00ff00;
    border-radius: 50%;
    z-index: 5;
    animation: spin 1s linear infinite;
    opacity: 0;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* === Play Button === */
.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px; 
    height: 40px; 
    line-height: 40px; 
    text-align: center; 
    font-size: 24px; 
    color: #00ff00;
    pointer-events: none;
    opacity: 0.8;
    text-shadow: 0 0 10px #00ff00;
    z-index: 5;
}


.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Loading state */
.video-container.loading::before {
    opacity: 1;
}

.video-container.loading .video-loading-spinner {
    opacity: 1;
}

/* Playing state */
.video-container.playing .gallery-video {
    opacity: 1;
}

.video-container.playing .video-play-button {
    opacity: 0;
}

/* Error state */
.video-container.error::before {
    opacity: 1;
}

.video-container.error .video-loading-spinner {
    border: none;
    animation: none;
    width: auto;
    height: auto;
    color: #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.video-container.error {
    background: #333;
}

/* === Gallery Header === */
.gallery-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    margin: 0;
    padding: 0 10px;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2999;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #00ff00;
}

.gallery-title {
    color: #00ff00;
    font-size: 22px;
    margin: 0;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

/* === Gallery Controls === */
.gallery-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.gallery-controls button {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00ff00;
    color: #00ff00;
    height: 30px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px;
    transition: all 0.3s ease;
}

.gallery-controls button:hover {
    background: rgba(0, 255, 0, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
    transform: translateY(-1px);
}

/* === Close Buttons === */
.close, .gallery-close, .photo-close {
    color: #00ff00;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover, .gallery-close:hover, .photo-close:hover {
    color: #ff00ff;
}

.gallery-close {
    padding: 0 5px;
    margin-left: 8px;
    transition: all 0.3s ease;
}

.gallery-close:hover {
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

/* === Gallery Content Area === */
.gallery-content {
    position: absolute;
    top: 40px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 15px;
    background: rgba(0, 0, 0, 0.95);
}

.gallery-content::-webkit-scrollbar {
    width: 6px;
    display: block;
}

.gallery-content::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 0, 0.3);
    border-radius: 3px;
}

.gallery-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 0, 0.5);
}

.info-row {
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-row span {
    color: #FFD700;
    margin-right: 5px;
}

.modal-info-details {
    background: rgba(0, 0, 0, 0.85);
    padding: 15px;
    margin-top: 15px;
    border: 1px solid #00ff00;
    border-radius: 5px;
}

.modal-info-details h3 {
    color: #FFD700;
    margin: 0 0 10px 0;
    font-size: 16px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

/* === Photo Modal Improvements === */
.photo-modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
    z-index: 2002;
}

#modalImage {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    margin: auto;
}

/* === Popup Message === */
.popup-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid #00ff00;
    color: #00ff00;
    padding: 20px 40px;
    font-size: 24px;
    border-radius: 5px;
    z-index: 9999;
    text-align: center;
    animation: popupPulse 1s infinite;
    backdrop-filter: blur(5px);
}

/* === Notifications === */
.notification {
    position: fixed;
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid #00ff00;
    color: #00ff00;
    border-radius: 5px;
    text-align: center;
    z-index: 9999;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.2);
}

@media (max-width: 768px) {
    /* Button adjustments */
    .system-log-btn {
        top: 10px;
        right: 10px;
        font-size: 14px;
        padding: 8px 16px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 120px;
    }

    .help-btn {
        top: 10px;
        right: 140px;
        width: 40px;
        height: 40px;
        padding: 8px;
        font-size: 20px;
    }

    .share-btn {
        top: 10px;
        right: 190px;
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    .camera-btn.button {
        top: 10px;
        right: 240px;
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    .button {
        height: 40px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .button svg {
        width: 24px;
        height: 24px;
    }

    h1 {
        font-size: 2.5rem;
        padding: 0 10px;
    }

    #visit-counter {
        bottom: 10px;
        right: 10px;
        padding: 8px 16px;
        font-size: 14px;
    }

    /* Gallery Modal Styles */
    .gallery-content {
        position: absolute;
        top: 40px;
        left: 0;
        right: 0;
        bottom: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: manipulation;
        margin: 0;
        padding: 0;
    }

    .gallery-content::-webkit-scrollbar {
        display: none;
    }
    
    .gallery-grid {
        margin: 0;
        padding: 10px;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        touch-action: manipulation;
    }
    
    .gallery-modal {
        margin: 0;
        padding: 0;
        overflow: auto;
    }

    .gallery-item {
        touch-action: manipulation;
        cursor: pointer;
    }
    
    .gallery-item:hover {
        transform: none !important;
        border-color: #00ff00;
    }

    .gallery-item video,
    .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .gallery-info {
        display: none;
    }
    .gallery-timestamp {
        margin-bottom: 5px;
        color: #fff;
    }
    
    .video-icon {
        display: none;
    }
    
    .info-row {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.3;
    }

    .info-row span {
        color: #ffd700;
        margin-right: 5px;
    }

    /* Photo Modal Styles */
    .photo-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.98);
        z-index: 3000;
        display: none;
    }

    .photo-modal-content {
        position: relative;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .photo-close {
        position: absolute;
        top: 5px;
        right: 5px;
        color: #00ff00;
        font-size: 30px;
        cursor: pointer;
        padding: 5px;
        z-index: 3001;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 3px;
        line-height: 20px;
        height: 30px;
        width: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #modalImage {
        max-width: 100%;
        max-height: 85vh;
        object-fit: contain;
        margin: 0;
    }

    .modal-system-info {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.8);
        padding: 8px;
        color: #00ff00;
        font-size: 11px;
    }
    
    #modalVideo {
        max-height: 70vh;
        width: 100%;
    }
}

/* Modal video styles */
#modalVideo {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    margin: auto;
    background: #000;
}

.photo-modal-content video {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

/* Video controls theming */
video::-webkit-media-controls-panel {
    background: rgba(0, 0, 0, 0.7);
}

video::-webkit-media-controls-play-button,
video::-webkit-media-controls-timeline,
video::-webkit-media-controls-current-time-display,
video::-webkit-media-controls-time-remaining-display,
video::-webkit-media-controls-mute-button,
video::-webkit-media-controls-volume-slider {
    color: #00ff00;
}

video::-webkit-media-controls-timeline {
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 2px;
}

/* === Animations === */
@keyframes notificationPulse {
    0% { border-color: #00ff00; box-shadow: 0 0 20px rgba(0, 255, 0, 0.2); }
    50% { border-color: #ff00ff; box-shadow: 0 0 30px rgba(255, 0, 255, 0.3); }
    100% { border-color: #00ff00; box-shadow: 0 0 20px rgba(0, 255, 0, 0.2); }
}

@keyframes counterPulse {
    0% { border-color: #00ff00; }
    50% { border-color: #ff00ff; }
    100% { border-color: #00ff00; }
}

@keyframes popupPulse {
    0% { border-color: #00ff00; }
    50% { border-color: #ff00ff; }
    100% { border-color: #00ff00; }
}
