/* Import del font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400&display=swap');

/* Reset e variabili CSS */
:root {
    /* Dimensioni iPhone 14 Pro (393x852) */
    --iphone-width: 393;
    --iphone-height: 852;
    --iphone-ratio: calc(393 / 852);

    /* Colori */
    --bg-gradient: linear-gradient(135deg, #000f55, #3659ff);
    --phone-frame: linear-gradient(145deg, #f5f5f7, #e8e8ed);
    --phone-border: #d1d1d6;
    --button-color: linear-gradient(90deg, #c7c7cc, #e8e8ed);
    --notch-color: linear-gradient(145deg, #f5f5f7, #e8e8ed);
    --indicator-color: #d1d1d6;
    --screen-bg: #000000;
    --content-bg: #ffffff;

    /* Dimensioni relative */
    --frame-padding: 3%;
    --screen-radius: 54px;
    --frame-radius: 60px;
    --notch-width: 126px;
    --notch-height: 30px;
    --indicator-width: 134px;
    --indicator-height: 5px;
}

/* Reset globale */
* {
    box-sizing: border-box;
}

/* Container principale - Occupa tutto lo spazio disponibile della colonna */
.iphone-preview-wrapper {
    width: 100%;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    border-radius: 2rem;
    padding: 2rem;
    position: relative;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
}

/* Container del mockup - Si adatta mantenendo le proporzioni esatte iPhone */
.iphone-mockup-container {
    width: 100%;
    height: 100%;
    max-width: 350px;
    max-height: 700px;
    aspect-ratio: 393 / 852; /* Proporzioni esatte iPhone 14 Pro */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Frame esterno del telefono */
.iphone-frame {
    width: 100%;
    height: 100%;
    background: var(--phone-frame);
    border: 2px solid var(--phone-border);
    border-radius: var(--frame-radius);
    position: relative;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Tasti laterali SINISTRA */
.iphone-buttons-left {
    position: absolute;
    left: -3px;
    top: 15%;
    display: flex;
    flex-direction: column;
    gap: 2%;
    z-index: 10;
}

.iphone-button-mute {
    width: 3px;
    height: 8%;
    background: var(--button-color);
    border-radius: 2px 0 0 2px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.iphone-button-volume-up,
.iphone-button-volume-down {
    width: 3px;
    height: 12%;
    background: var(--button-color);
    border-radius: 2px 0 0 2px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Tasto laterale DESTRA */
.iphone-buttons-right {
    position: absolute;
    right: -3px;
    top: 20%;
    z-index: 10;
}

.iphone-button-power {
    width: 3px;
    height: 20%;
    background: linear-gradient(270deg, #c7c7cc, #e8e8ed);
    border-radius: 0 2px 2px 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Schermo interno */
.iphone-screen {
    position: absolute;
    top: var(--frame-padding);
    left: var(--frame-padding);
    right: var(--frame-padding);
    bottom: var(--frame-padding);
    background: var(--screen-bg);
    border-radius: var(--screen-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Area contenuto - Mantiene proporzioni iPhone per il contenuto */
.iphone-content-area {
    position: absolute;
    top: 0; /* Spazio per Dynamic Island */
    left: 0;
    right: 0;
    bottom: 0; /* Spazio per Home Indicator */
    background: var(--content-bg);
    border-radius: 52px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Iframe che mantiene le proporzioni esatte */
.iphone-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: var(--content-bg);
}

/* Home Indicator */
.iphone-home-indicator {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: var(--indicator-width);
    height: var(--indicator-height);
    background: var(--indicator-color);
    border-radius: 3px;
    z-index: 30;
}

/* Placeholder quando non c'è contenuto */
.iphone-placeholder {
    position: absolute;
    top: 60px;
    left: 8px;
    right: 8px;
    bottom: 34px;
    background: var(--content-bg);
    border-radius: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8e8e93;
    text-align: center;
    padding: 2rem;
}

.iphone-placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.iphone-placeholder-text {
    font-size: 1rem;
    line-height: 1.4;
    opacity: 0.8;
}

/* Responsive Design */

/* Tablet */
@media (max-width: 768px) {
    .iphone-preview-wrapper {
        padding: 1.5rem;
        min-height: 400px;
    }

    .iphone-mockup-container {
        max-width: 300px;
        max-height: 600px;
    }

    :root {
        --screen-radius: 48px;
        --frame-radius: 54px;
        --notch-width: 110px;
        --notch-height: 26px;
        --indicator-width: 120px;
    }

    .iphone-content-area,
    .iphone-placeholder {
        border-radius: 46px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .iphone-preview-wrapper {
        padding: 1rem;
        min-height: 350px;
        border-radius: 1.5rem;
    }

    .iphone-mockup-container {
        max-width: 300px;
        max-height: 600px;
    }

    :root {
        --screen-radius: 42px;
        --frame-radius: 48px;
        --notch-width: 95px;
        --notch-height: 22px;
        --indicator-width: 100px;
        --indicator-height: 4px;
    }

    .iphone-content-area,
    .iphone-placeholder {
        border-radius: 40px;
    }

    .iphone-home-indicator {
        bottom: 10px;
    }
}

/* Desktop hover effects */
@media (min-width: 769px) {
    .iphone-frame {
        transition: all 0.3s ease;
    }

    .iphone-preview-wrapper:hover .iphone-frame {
        transform: translateY(-4px) scale(1.01);
        box-shadow:
            inset 0 2px 4px rgba(255, 255, 255, 0.4),
            inset 0 -2px 4px rgba(0, 0, 0, 0.1),
            0 12px 48px rgba(0, 0, 0, 0.25);
    }
}

/* Modalità scura */
@media (prefers-color-scheme: dark) {
    :root {
        --phone-frame: linear-gradient(145deg, #2c2c2e, #1c1c1e);
        --phone-border: #38383a;
        --button-color: linear-gradient(90deg, #48484a, #38383a);
        --notch-color: linear-gradient(145deg, #2c2c2e, #1c1c1e);
    }
}

/* Utilità per nascondere elementi non utilizzati */
.hidden {
    display: none !important;
}

/* Classi di compatibilità per il codice esistente */
.custom-iframe-desktop,
.custom-iframe-mobile {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.placeholder-content {
    text-align: center;
    color: #8e8e93;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder-text {
    font-size: 1rem;
    line-height: 1.4;
    opacity: 0.8;
}
