/* =========================================================
   VARIABILI GLOBALI
   ========================================================= */

:root {
    --primary-color: #1a73e8;
    --background-color: #f1f3f4;
    --card-color: #ffffff;
    --text-color: #202124;
    --muted-color: #5f6368;

    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-strong: 0 12px 32px rgba(0, 0, 0, 0.25);
}


/* =========================================================
   RESET BASE
   ========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
}


/* =========================================================
   HEADER
   ========================================================= */

.top-bar {
    background-color: #ffffff;
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 18px;
    font-weight: 700;
}

.top-bar nav a {
    margin-left: 20px;
    text-decoration: none;
    font-size: 14px;
    color: var(--muted-color);
}

.top-bar nav a:hover {
    color: var(--primary-color);
}


/* =========================================================
   LAYOUT PRINCIPALE
   ========================================================= */

.page {
    display: grid;
    grid-template-columns: 240px 1fr 240px;
    gap: 24px;
    padding: 40px;
}

.content {
    text-align: center;
}

h1 {
    font-size: 26px;
    margin-bottom: 24px;
}


/* =========================================================
   CARD GENERATORE
   ========================================================= */

.generator-card {
    background-color: var(--card-color);
    border-radius: 16px;
    padding: 30px;
    max-width: 420px;
    margin: 0 auto;
    box-shadow: var(--shadow-medium);
}

.result {
    font-size: 72px;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.input-group {
    flex: 1;
    text-align: left;
}

label {
    font-size: 13px;
    color: var(--muted-color);
}

input {
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #dadce0;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
}

button {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: bold;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

button:hover {
    background-color: #1558b0;
}


/* =========================================================
   BANNER PUBBLICITARI LATERALI
   ========================================================= */

.ad-banner {
    background: transparent;
}

/* Fibra destra (verticale più lunga) */
.static-ad img {
    display: block;
    width: 100%;
    max-height: 420px;
    height: auto;
    object-fit: contain;
    background-color: #ffffff;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: var(--shadow-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.static-ad img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-medium);
}

/* Fibra sinistra (forma diversa) */
.static-ad-left img {
    max-height: 300px;
    object-fit: contain;
}


/* =========================================================
   POPUP iPHONE (LATERALE)
   ========================================================= */

.popup-ad {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 300px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: var(--shadow-strong);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 9999;
}

.popup-ad.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.popup-ad img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.popup-content {
    padding: 14px;
    text-align: center;
}

.popup-content h4 {
    font-size: 16px;
    margin-bottom: 6px;
    color: var(--primary-color);
}

.popup-content p {
    font-size: 13px;
    color: var(--muted-color);
}

.popup-content a {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 14px;
    background-color: var(--primary-color);
    color: #ffffff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
}

.popup-close {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 18px;
    cursor: pointer;
    color: #666666;
}


/* =========================================================
   POPUP FIBRA DAL BASSO (RETTANGOLARE)
   ========================================================= */

.popup-fibra {
    position: fixed;
    bottom: -220px;
    left: 50%;
    transform: translateX(-50%);
    width: 420px;
    background-color: #ffffff;
    border-radius: 14px 14px 0 0;
    box-shadow: var(--shadow-strong);
    opacity: 0;
    transition: bottom 0.5s ease, opacity 0.5s ease;
    z-index: 9998;
}

.popup-fibra.show {
    bottom: 0;
    opacity: 1;
}

/* IMMAGINE CALIBRATA CORRETTAMENTE */
.popup-fibra img {
    display: block;
    width: 100%;
    height: 160px;              /* altezza ottimale */
    object-fit: contain;        /* immagine intera */
    object-position: center;
    background-color: #ffffff;
}

.popup-fibra-content {
    padding: 12px;
    text-align: center;
}

.popup-fibra-content a {
    display: inline-block;
    padding: 10px 18px;
    background-color: var(--primary-color);
    color: #ffffff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
}

.popup-fibra-close {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 18px;
    cursor: pointer;
    color: #666666;
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: var(--muted-color);
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {

    .page {
        grid-template-columns: 1fr;
    }

    .static-ad img,
    .static-ad-left img {
        max-height: 280px;
    }

    .popup-ad {
        right: 15px;
        bottom: 15px;
    }
}

@media (max-width: 500px) {

    .popup-fibra {
        width: 100%;
        border-radius: 0;
    }
}
