/* Padding al main-content invece che al body */

.main-content {

    height: calc(100vh - <altezza-header>);
    overflow: auto;
    padding: 20px;
    padding-bottom: 150px;
    padding-top: calc(60px + env(safe-area-inset-top));
}



/* Nasconde barra browser + status bar */

html, body {

  height: 100vh;

  margin: 0;

  padding: 0;

  /*overflow: hidden;*/

}



body {

  padding-top: env(safe-area-inset-top);

  padding-left: env(safe-area-inset-left);

  padding-right: env(safe-area-inset-right);

  padding-bottom: 160px;

}



/* Schermo intero quando app installata */

@media all and (display-mode: fullscreen) {

  body { padding: 0; }

}



/* Nasconde barra Safari iOS */

body[apple-web-app-status-bar-style="black-translucent"] {

  padding-top: 0 !important;

}

/* Barra in alto fissa */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding-top: env(safe-area-inset-top);
}

/* Aggiusta il padding del main-content per fare spazio alla barra fissa */
.main-content {
    padding: 20px;
    padding-bottom: 50px;
    padding-top: calc(60px + env(safe-area-inset-top)); /* Adatta in base all'altezza della barra */
}

/* Se la barra ha una classe specifica tipo .header o .navbar */
header, .header, .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.date-group {
    margin-bottom: 10px;
    width: 100%;
}

.date-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    padding-bottom: 0;
    margin-bottom: 10px;
    margin-top: 0;
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100% !important;
}

.work-card {
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
    width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
    max-width: 100% !important;
}

.work-row {
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.work-row:last-child {
    margin-bottom: 0;
}

.footer-bar {
    position: fixed;
    bottom: 30px;                  
    left: 0;
    right: 0;
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    padding: 10px;
    display: flex;
    gap: 10px;
    justify-content: center;
    z-index: 99;                   
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.btn-footer {
    background-color: #484848;
    color: white;
    border: none;
    padding: 16px 30px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-footer:hover {
    background-color: #3d3d3d;
}

.btn-footer:active {
    transform: scale(0.98);
}

/* Aggiungi padding al body per evitare che il contenuto vada sotto la barra */
body {
    padding-bottom: 110px;
}

/* POPUP */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 10px;
}

.popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.popup-close:hover {
    color: #000;
}

.popup-content h2 {
    margin: 0 0 15px 0;
    margin-bottom: 20px;
    color: #333;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.btn-primary {
    background-color: #484848;
    color: white;
    padding: 16px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    width: 100%;
    margin-bottom: 30px;
}

.btn-primary:hover {
    background-color: #3d3d3d;
}


/* Media query per smartphone molto piccoli */
@media (max-width: 360px) {
    .popup-content {
        padding: 15px;
    }
    
    .popup-content h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 3px;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 4px;
        font-size: 13px;
    }
    
}