/* Reset e variabili */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF69B4;
    --secondary-color: #8A2BE2;
    --accent-color: #FFD700;
    --bg-gradient-1: #FF69B4;
    --bg-gradient-2: #8A2BE2;
    --text-dark: #2C3E50;
    --text-light: #FFFFFF;
    --success-color: #10B981;
    --error-color: #EF4444;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    min-height: 100vh;
    height: 100vh;
    /* Forza altezza schermo pieno */
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    margin: 0;
    padding: 0;
}

/* Sfondo animato con cuori */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.heart {
    position: absolute;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    animation: float 20s infinite;
}

.heart:before,
.heart:after {
    content: '';
    position: absolute;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.heart:before {
    top: -25px;
    left: 0;
}

.heart:after {
    top: 0;
    left: -25px;
}

.heart:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 15s;
}

.heart:nth-child(2) {
    left: 30%;
    animation-delay: 2s;
    animation-duration: 18s;
}

.heart:nth-child(3) {
    left: 50%;
    animation-delay: 4s;
    animation-duration: 22s;
}

.heart:nth-child(4) {
    left: 70%;
    animation-delay: 6s;
    animation-duration: 17s;
}

.heart:nth-child(5) {
    left: 90%;
    animation-delay: 8s;
    animation-duration: 20s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(45deg) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) rotate(45deg) scale(1);
        opacity: 0;
    }
}

/* Gestione pagine */
.page {
    display: none;
    min-height: 100vh;
    height: 100vh;
    padding: 30px 20px;
}

.page.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.page.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.page.fade-out {
    animation: fadeOut 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Pagina di benvenuto */
.welcome-container {
    text-align: center;
    max-width: 90%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 85vh;
}

.main-title {
    font-size: 5rem;
    font-weight: bold;
    margin-bottom: 2rem;
    line-height: 1.2;
    animation: pulse 2s ease-in-out infinite;
}

.gradient-text {
    background: linear-gradient(45deg, #FFD700, #FF69B4, #8A2BE2, #FFD700);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.subtitle {
    font-size: 2rem;
    color: white;
    margin-bottom: 4rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
}

.choice-buttons {
    display: flex;
    gap: 3rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

.choice-btn {
    background: white;
    border: none;
    border-radius: 25px;
    padding: 4rem 5rem;
    font-size: 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 250px;
    gap: 1.5rem;
    min-width: 250px;
}

.choice-btn:hover {
    transform: translateY(-10px) scale(1.08);
    box-shadow: var(--shadow-lg);
}

.choice-btn .icon {
    font-size: 6rem;
}

.choice-btn .text {
    font-weight: bold;
    font-size: 2rem;
}

.sposo-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sposa-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.welcome-features {
    display: flex;
    justify-content: center;
    gap: 4rem;
    flex-wrap: wrap;
    margin-top: 3rem;
}

.feature {
    color: white;
    text-align: center;
    font-size: 1.3rem;
    max-width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.feature-icon {
    font-size: 2.5rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.feature-text {
    font-size: 1rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Container comuni */
.capture-container,
.style-container,
.result-container {
    background: white;
    border-radius: 30px;
    padding: 3rem 2rem;
    max-width: 95%;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: #f3f4f6;
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.back-btn:hover {
    background: #e5e7eb;
    transform: translateX(-5px);
}

.page-title {
    font-size: 3rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: bold;
}

.page-subtitle {
    font-size: 1.2rem;
    color: #6B7280;
    margin-bottom: 2rem;
    text-align: center;
}

/* Pagina cattura foto */
.camera-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 2rem;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow-md);
    aspect-ratio: 9/16;
    /* Standardized to 9/16 */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* Ensure relative positioning for placeholder */
}

.camera-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 2;
}

.btn-start-camera {
    font-size: 1.5rem;
    padding: 1.5rem 3rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 3;
}

#video,
#photoPreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#video {
    transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
}

.camera-controls {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* Bottoni */
.btn {
    padding: 1.5rem 3rem;
    border: none;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.btn-secondary {
    background: #6B7280;
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-generate {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: var(--text-dark);
    font-size: 1.3rem;
    padding: 1.5rem 3rem;
    margin-top: 2rem;
}

/* Pagina stili */
.photo-mini-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f3f4f6;
    border-radius: 15px;
}

.photo-mini-preview img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

#roleIndicator {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-dark);
}

.styles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding: 1rem;
}

.style-btn {
    background: #f3f4f6;
    border: 3px solid transparent;
    border-radius: 20px;
    padding: 2rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    min-height: 140px;
    justify-content: center;
}

.style-btn:hover {
    background: #e5e7eb;
    transform: translateY(-5px);
    box-shadow: var(--shadow-sm);
}

.style-btn.selected {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-color: var(--accent-color);
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

.style-icon {
    font-size: 3.5rem;
}

.style-name {
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    font-size: 0.9rem;
}

.selected-styles-container {
    background: #f3f4f6;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.selected-styles-container h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-size: 1.2rem;
}

.selected-styles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.no-selection {
    color: #9CA3AF;
    font-style: italic;
}

.selected-style-tag {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Pagina risultato */
.loading-container {
    text-align: center;
    padding: 3rem;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 8px solid #f3f4f6;
    border-top: 8px solid var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 2rem;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.loading-subtext {
    font-size: 1rem;
    color: #6B7280;
}

.result-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.result-image-container {
    text-align: center;
}

.result-image-container h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-size: 1.3rem;
}

.result-image-container img {
    width: 100%;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.result-image-container img:hover {
    transform: scale(1.05);
}

.email-section {
    background: #f3f4f6;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.email-section h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-size: 1.3rem;
    text-align: center;
}

.email-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.email-input {
    flex: 1;
    min-width: 250px;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.email-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.email-status {
    text-align: center;
    margin-top: 1rem;
    font-size: 1rem;
}

.status-loading {
    color: #6B7280;
}

.status-success {
    color: var(--success-color);
    font-weight: 600;
}

.status-error {
    color: var(--error-color);
    font-weight: 600;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .choice-buttons {
        flex-direction: column;
        gap: 1rem;
    }

    .choice-btn {
        min-width: auto;
        width: 100%;
    }

    .welcome-features {
        flex-direction: column;
        gap: 1.5rem;
    }

    .capture-container,
    .style-container,
    .result-container {
        padding: 1.5rem;
    }

    .page-title {
        font-size: 1.8rem;
    }

    .styles-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .result-images {
        grid-template-columns: 1fr;
    }

    .email-form {
        flex-direction: column;
    }
}

/* Sezione Video */
.video-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    color: white;
}

.video-section h3 {
    color: white;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.video-description {
    margin-bottom: 1.5rem;
    font-size: 1rem;
    opacity: 0.9;
}

.btn-video {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: var(--text-dark);
    font-size: 1.2rem;
    padding: 1.2rem 2.5rem;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.8);
    }
}

.video-status {
    margin-top: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.video-status .status-loading {
    color: white;
}

.video-status .status-success {
    color: #10B981;
}

.video-status .status-error {
    color: #FCA5A5;
}

.video-player {
    margin-top: 2rem;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.video-player video {
    width: 100%;
    max-width: 800px;
    border-radius: 10px;
}

/* Immagini cliccabili */
.clickable-image {
    cursor: zoom-in;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.clickable-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

.image-hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #6B7280;
    font-style: italic;
}

/* Modal Fullscreen */
.fullscreen-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.fullscreen-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.fullscreen-content {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.2);
    animation: zoomIn 0.3s ease;
    cursor: zoom-out;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.close-fullscreen {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 10000;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.close-fullscreen:hover {
    transform: scale(1.2) rotate(90deg);
    color: #FF69B4;
}

.fullscreen-caption {
    color: white;
    font-size: 1rem;
    margin-top: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    opacity: 0.8;
}