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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    padding: 20px;
}

.photobooth-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

h1 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h3 {
    color: #fff;
    margin: 15px 0 10px;
    font-size: 1.1rem;
}

/* Page Navigation */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Shot Selection */
.shot-selection {
    margin-bottom: 20px;
}

.shot-selection label {
    color: #fff;
    display: block;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.shot-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.shot-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.shot-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.shot-btn.selected {
    background: linear-gradient(135deg, #e94560 0%, #ff6b6b 100%);
    border-color: #e94560;
    transform: scale(1.1);
}

/* Camera Section */
.camera-section {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

#video {
    width: 100%;
    max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    background: #000;
    transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
    -moz-transform: scaleX(-1);
}

.capture-frame {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    height: 100%;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 4px solid #e94560;
}

.top-left {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
    border-radius: 15px 0 0 0;
}

.top-right {
    top: -2px;
    right: -2px;
    border-left: none;
    border-bottom: none;
    border-radius: 0 15px 0 0;
}

.bottom-left {
    bottom: -2px;
    left: -2px;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 15px;
}

.bottom-right {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 15px 0;
}

.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(233, 69, 96, 0.8);
    display: none;
}

.countdown.active {
    display: block;
    animation: pulse 1s ease-in-out;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.shot-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(233, 69, 96, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    display: none;
}

.shot-counter.active {
    display: block;
}

/* Controls */
.controls, .editor-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.capture-btn {
    background: linear-gradient(135deg, #e94560 0%, #ff6b6b 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.capture-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.6);
}

.btn:not(.capture-btn) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn:not(.capture-btn):hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-icon {
    font-size: 1.2rem;
}

/* Editor Section */
.photo-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #e94560;
}

.photo-counter {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 15px;
    opacity: 0.8;
}

.editor-preview {
    position: relative;
    display: inline-block;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

#editorCanvas {
    max-width: 100%;
    max-height: 350px;
    display: block;
}

/* Collage Styles */
.collage-preview {
    margin-bottom: 20px;
}

#collageCanvas {
    max-width: 100%;
    max-height: 400px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.collage-templates {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.collage-template {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.collage-template:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.collage-template.selected {
    border-color: #e94560;
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.5);
}

.collage-template canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-size: cover;
    background-position: center;
}

.editor-section {
    margin-bottom: 15px;
}

.filter-buttons, .frame-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 10px;
}

.filter-btn, .frame-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover, .frame-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.filter-btn.active, .frame-btn.active {
    background: linear-gradient(135deg, #e94560 0%, #ff6b6b 100%);
    border-color: #e94560;
}

/* Filter Styles */
#editorCanvas.filter-grayscale { filter: grayscale(100%); }
#editorCanvas.filter-sepia { filter: sepia(100%); }
#editorCanvas.filter-vintage { filter: sepia(50%) contrast(90%) brightness(90%); }
#editorCanvas.filter-warm { filter: sepia(30%) saturate(140%) brightness(110%); }
#editorCanvas.filter-cool { filter: saturate(80%) hue-rotate(20deg); }
#editorCanvas.filter-vivid { filter: saturate(150%) contrast(110%); }
#editorCanvas.filter-fade { filter: saturate(80%) brightness(110%) contrast(90%); }
#editorCanvas.filter-dramatic { filter: contrast(140%) brightness(90%); }
#editorCanvas.filter-dreamy { filter: brightness(115%) blur(0.5px); }
#editorCanvas.filter-cinema { filter: contrast(110%) saturate(110%) brightness(95%); }
#editorCanvas.filter-noir { filter: grayscale(100%) contrast(120%); }
#editorCanvas.filter-sunset { filter: sepia(40%) saturate(150%) contrast(110%); }
#editorCanvas.filter-moody { filter: brightness(90%) contrast(110%) saturate(90%); }

/* Frame Styles */
.frame-overlay.frame-polaroid {
    background: linear-gradient(white 15%, transparent 15%),
                linear-gradient(90deg, transparent 15%, white 15%, white 85%, transparent 85%),
                linear-gradient(transparent 85%, white 85%);
    box-shadow: inset 0 0 30px rgba(0,0,0,0.3);
}

.frame-overlay.frame-neon {
    background: 
        radial-gradient(circle at 20% 20%, #ff00ff20 0%, transparent 30%),
        radial-gradient(circle at 80% 20%, #00ffff20 0%, transparent 30%),
        radial-gradient(circle at 20% 80%, #00ff0020 0%, transparent 30%),
        radial-gradient(circle at 80% 80%, #ffff0020 0%, transparent 30%);
    box-shadow: inset 0 0 50px rgba(255, 0, 255, 0.3);
}

.frame-overlay.frame-birthday {
    background: 
        repeating-linear-gradient(45deg, transparent, transparent 10px, #ff69b420 10px, #ff69b420 20px),
        repeating-linear-gradient(-45deg, transparent, transparent 10px, #ff149320 10px, #ff149320 20px);
}

.frame-overlay.frame-valentine {
    background: radial-gradient(circle at center, #ff69b410 0%, transparent 70%);
    box-shadow: inset 0 0 80px rgba(255, 105, 180, 0.3);
}

.frame-overlay.frame-christmas {
    background: 
        linear-gradient(0deg, #228B2210 0%, #228B2210 100%),
        repeating-linear-gradient(90deg, transparent, transparent 20px, #ff000010 20px, #ff000010 40px);
}

.frame-overlay.frame-sparkle {
    background: 
        radial-gradient(circle at 10% 10%, white 0%, transparent 2%),
        radial-gradient(circle at 90% 20%, white 0%, transparent 2%),
        radial-gradient(circle at 30% 80%, white 0%, transparent 2%),
        radial-gradient(circle at 80% 70%, white 0%, transparent 2%),
        radial-gradient(circle at 50% 50%, gold 0%, transparent 3%);
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.frame-overlay.frame-retro {
    background: 
        linear-gradient(135deg, #ff6b6b10 25%, transparent 25%),
        linear-gradient(225deg, #ff6b6b10 25%, transparent 25%),
        linear-gradient(45deg, #ff6b6b10 25%, transparent 25%),
        linear-gradient(315deg, #ff6b6b10 25%, transparent 25%);
    background-size: 20px 20px;
    box-shadow: inset 0 0 30px rgba(255, 107, 107, 0.2);
}

.frame-overlay.frame-vintageframe {
    background: 
        linear-gradient(45deg, #8B451320 25%, transparent 25%),
        linear-gradient(-45deg, #8B451320 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #8B451320 75%),
        linear-gradient(-45deg, transparent 75%, #8B451320 75%);
    background-size: 20px 20px;
    background-color: #D2B48C;
    box-shadow: inset 0 0 40px rgba(139, 69, 19, 0.4);
}

.frame-overlay.frame-film {
    background: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, #000 2px, #000 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, #fff 2px, #fff 3px);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.frame-overlay.frame-gold {
    background: linear-gradient(45deg, #FFD70020, #FFA50020, #FFD70020);
    border: 8px solid;
    border-image: linear-gradient(45deg, #FFD700, #FFA500, #FFD700) 1;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.frame-overlay.frame-silver {
    background: linear-gradient(45deg, #C0C0C020, #E8E8E820, #C0C0C020);
    border: 8px solid;
    border-image: linear-gradient(45deg, #C0C0C0, #E8E8E8, #C0C0C0) 1;
    box-shadow: 0 0 30px rgba(192, 192, 192, 0.3);
}

.frame-overlay.frame-holiday {
    background: 
        radial-gradient(circle at 30% 30%, #87CEEB30 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, #90EE9020 0%, transparent 40%);
    border: 15px solid transparent;
    border-image: repeating-linear-gradient(45deg, #FF6B6B, #4ECDC4, #45B7D1, #FF6B6B) 1;
}

.frame-overlay.frame-paper {
    background: #FFFEF0;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.1);
}

.frame-overlay.frame-tape {
    background: 
        linear-gradient(90deg, transparent 20%, rgba(255, 200, 100, 0.3) 20%, rgba(255, 200, 100, 0.3) 25%, transparent 25%),
        linear-gradient(90deg, transparent 75%, rgba(255, 200, 100, 0.3) 75%, rgba(255, 200, 100, 0.3) 80%, transparent 80%);
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.gallery-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
}

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

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.gallery-item .delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(233, 69, 96, 0.9);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.gallery-item .delete-btn:hover {
    background: #ff4757;
    transform: scale(1.1);
}

.gallery-item .timestamp {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 30px 10px 10px;
    font-size: 0.85rem;
}

.empty-gallery {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 60px 20px;
    font-style: italic;
    font-size: 1.1rem;
}

/* Flash Effect */
.flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
}

.flash.active {
    animation: flashAnim 0.3s ease-out;
}

@keyframes flashAnim {
    0% { opacity: 0.9; }
    100% { opacity: 0; }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #e94560;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    position: absolute;
    color: #fff;
    font-size: 1.2rem;
    margin-top: 80px;
}

/* Camera Loading Pulse */
.camera-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.camera-loading.active {
    display: block;
}

.camera-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #e94560;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Processing Animation */
.processing-animation {
    display: inline-block;
}

.processing-animation::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Responsive */
@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }
    
    #video {
        max-width: 100%;
    }
    
    .controls, .editor-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .filter-buttons, .frame-buttons {
        gap: 5px;
    }
    
    .filter-btn, .frame-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
}

