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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    background: linear-gradient(20deg, #414584 0%, #060824 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.screen.active {
    display: flex;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 800px;
    width: 100%;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #667eea;
}

h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #667eea;
}

p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #666;
}

.session-id {
    font-size: 1rem;
    margin-bottom: 20px;
    color: #888;
    font-family: monospace;
}

#session-id-display {
    font-weight: bold;
    color: #667eea;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled,
.primary-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.primary-btn:disabled:hover,
.primary-btn.disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.secondary-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
    margin: 0 10px;
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.6);
}

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

.back-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
    margin: 0 10px;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.6);
    background: #5a6268;
}

.back-btn:active {
    transform: translateY(0);
}

.hidden {
    display: none !important;
}

.camera-container {
    margin: 30px 0;
    position: relative;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

#video {
    width: 100%;
    display: block;
}

#canvas {
    display: none;
    width: 100%;
}

#canvas.show {
    display: block;
}

.button-group {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.form-container {
    max-width: 700px;
}

form {
    text-align: left;
    margin-top: 30px;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    resize: vertical;
    background-color: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    min-height: 100px;
}

.char-count {
    display: block;
    text-align: right;
    font-size: 0.85rem;
    color: #999;
    margin-top: 5px;
}

.form-group input:focus + .char-count,
.form-group textarea:focus + .char-count {
    color: #667eea;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
    accent-color: #667eea;
}

.checkbox-helper {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

/* Prize banner */
.prize-banner {
    margin-top: 25px;
    padding: 18px 20px;
    border-radius: 12px;
    background: linear-gradient(120deg, #ffe29f, #ffc107);
    color: #5b3600;
    display: none;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 25px rgba(255, 193, 7, 0.3);
}

.prize-banner.show {
    display: flex;
}

.prize-icon {
    font-size: 2.5rem;
}

.prize-details h3 {
    margin: 0;
    font-size: 1.3rem;
}

.prize-details p {
    margin: 4px 0 0;
    font-size: 1rem;
}

form .button-group {
    margin-top: 30px;
}

/* Loading Screen */
.loading-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    border: 8px solid #f3f3f3;
    border-top: 8px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-subtext {
    font-size: 1.1rem;
    color: #999;
    margin-top: 10px;
}

#loading-text {
    color: #667eea;
    margin-bottom: 10px;
}

/* Result Screen */
.result-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.result-image-container {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: #f5f5f5;
}

#generated-image {
    width: 100%;
    height: auto;
    display: block;
}

.qr-container {
    flex: 0 0 auto;
    min-width: 250px;
    max-width: 300px;
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#download-qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* Options Screen */
.options-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 40px 0;
    flex-wrap: wrap;
}

.option-card {
    background: #f8f9fa;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.option-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.option-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    display: block;
}

.option-card h3 {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 600;
}

.option-card p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.option-card .primary-btn {
    width: 100%;
    margin: 0;
}

.logout-btn{
    width: 60px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .container {
        padding: 30px 20px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    p {
        font-size: 1rem;
    }

    .primary-btn, .secondary-btn, .back-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
        margin: 5px 0;
    }

    .options-container {
        flex-direction: column;
        gap: 20px;
    }

    .option-card {
        min-width: auto;
        padding: 30px 20px;
    }

    .option-icon {
        font-size: 3rem;
    }

    .result-content {
        flex-direction: column;
        gap: 20px;
    }

    .result-image-container {
        max-width: 100%;
    }

    .qr-container {
        max-width: 100%;
    }
}

/* Images Gallery Screen */
.images-gallery {
    margin: 30px 0;
    min-height: 300px;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 10px;
}

.image-wrapper {
    position: relative;
    width: 100%;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 10px;
}

.image-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.gallery-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
}

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

.images-gallery img {
    transition: all 0.3s ease;
}

.images-gallery img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

/* Responsive adjustments for images gallery */
@media (max-width: 768px) {
    .images-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
        padding: 0 5px;
    }
    
    .image-wrapper {
        min-height: 150px;
        padding: 8px;
    }
    
    .gallery-image {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .images-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .image-wrapper {
        min-height: auto;
    }
    
    .gallery-image {
        max-height: 400px;
    }
}

/* Confirmation Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    position: relative;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

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

.modal-title {
    font-size: 1.8rem;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 600;
}

.modal-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    min-width: 120px;
}

.modal-btn-cancel {
    background: #6c757d;
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.modal-btn-cancel:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.6);
    background: #5a6268;
}

.modal-btn-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.modal-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.modal-btn:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    .modal-content {
        padding: 30px 20px;
        max-width: 90%;
    }
    
    .modal-icon {
        font-size: 3rem;
    }
    
    .modal-title {
        font-size: 1.5rem;
    }
    
    .modal-message {
        font-size: 1rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
}

/* Filter Pills Container */
.filter-pills-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 30px 0;
    padding: 0 10px;
}

.filter-pill {
    background: #f8f9fa;
    color: #667eea;
    border: 2px solid #e0e0e0;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    white-space: nowrap;
}

.filter-pill:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.filter-pill.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.filter-pill.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Image Cards Container */
.image-cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
    padding: 0 10px;
}

.image-card {
    position: relative;
    background: #f8f9fa;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 3px solid transparent;
}

.image-card.hidden {
    display: none;
}

.image-card.fade-out {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

.image-card.fade-in {
    opacity: 1;
    transform: scale(1);
    animation: fadeInCard 0.3s ease;
}

.image-card.selected {
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

.image-card {
    position: relative;
    background: #f8f9fa;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Hide the native radio button */
.image-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

.image-checkbox-label {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-checkbox-label img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.image-card:hover .image-checkbox-label img {
    transform: scale(1.05);
}

/* Checkmark styling */
.checkmark {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
    z-index: 10;
}

.image-checkbox:checked + .image-checkbox-label .checkmark {
    opacity: 1;
    transform: scale(1);
}

.image-checkbox:checked + .image-checkbox-label img {
    opacity: 0.8;
}

.image-card.selected .image-checkbox-label img {
    opacity: 0.8;
}

/* Image Enlarged Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

.image-modal.show {
    display: flex;
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.close-image-btn {
    position: absolute;
    top: -40px;
    right: -40px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 2001;
    line-height: 1;
    padding: 0;
}

.close-image-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.close-image-btn:active {
    transform: scale(0.95);
}

/* Responsive adjustments for image cards */
@media (max-width: 768px) {
    .filter-pills-container {
        gap: 8px;
    }
    
    .filter-pill {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .image-cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 5px;
    }
    
    .close-image-btn {
        top: -30px;
        right: -30px;
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .filter-pills-container {
        gap: 6px;
    }
    
    .filter-pill {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .image-cards-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .close-image-btn {
        top: -25px;
        right: -25px;
        width: 30px;
        height: 30px;
        font-size: 20px;
    }
    
    .image-modal-content {
        max-width: 95%;
        max-height: 85%;
    }
}
