:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #ec4899;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-color), #1e1b4b);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.container {
    width: 95%;
    max-width: 1400px;
    padding: 3rem;
    text-align: center;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

/* Main Menu Modes */
.modes-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-card {
    flex: 1;
    min-width: 300px;
    padding: 2.5rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--glass-border);
    background: var(--card-bg);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    transform: scaleX(0);
    transition: transform 0.4s ease;
    transform-origin: left;
}

.mode-card:hover {
    transform: translateY(-10px);
    background: rgba(45, 55, 72, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.mode-card:hover::before {
    transform: scaleX(1);
}

.mode-icon {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.placeholder-icon {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    padding: 1rem 2rem;
    border-radius: 16px;
    border: 1px dashed var(--primary);
}

.placeholder-icon small {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Photobooth Area */
.photobooth-area {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: stretch;
}

.camera-section {
    flex: 2;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-height: 65vh;
}

#camera-stream {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror effect */
}

.countdown-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 20px rgba(0,0,0,0.8);
    display: none;
    z-index: 10;
}

.flash-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
    transition: opacity 0.1s ease-out;
}

.controls-section {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
}

.btn {
    padding: 1.5rem 2rem;
    font-size: 1.5rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Outfit', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.5);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(59, 130, 246, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
}

.hidden {
    display: none !important;
}

/* Result Preview */
.result-section {
    width: 100%;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

#result-canvas {
    max-width: 100%;
    height: auto;
    max-height: 70vh;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    background: white; /* Default background for transparent frames */
}

.status-text {
    font-size: 1.1rem;
    color: #cbd5e1;
    margin-top: 1rem;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.back-btn {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.back-btn:hover {
    color: white;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        width: 100%;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .top-bar div {
        display: flex;
        width: 100%;
        justify-content: space-between;
    }
    
    .photobooth-area {
        flex-direction: column;
    }
    
    .camera-section {
        min-height: 50vh;
        width: 100%;
    }
    
    .controls-section {
        width: 100%;
    }
    
    .btn {
        padding: 1rem;
        font-size: 1.2rem;
        width: 100%;
    }
    
    .controls-section div {
        flex-direction: column;
        width: 100%;
    }
    
    select#save-location {
        width: 100%;
        margin-bottom: 10px;
    }
}
