@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.css');

body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
    overflow: hidden; /* Previene scorrimento */
    transition: background-color 1s ease;
}

.ad-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
}

.center-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.adplugg-tag {
    min-height: 100px;
    width: 100%;
    max-width: 300px;
}

.adplugg-tag.left,
.adplugg-tag.right {
    min-width: 100px;
    min-height: 200px;
    max-width: 150px;
}

.adplugg-tag.top,
.adplugg-tag.bottom {
    min-height: 100px;
    width: 100%;
    max-width: 300px;
}

::selection {
      background-color: #1b912b;
      color: #fff;
}

.clock-container {
    text-align: center;
}

.clock {
    font-size: 5rem;
    font-weight: bold;
    color: #1a1a1a;
    text-shadow: 0 0 20px #0000001a;
    letter-spacing: normal;
}

.clock .separator {
    margin: 0 0.2em;
}

.date {
    margin-top: 1rem;
    font-size: 1.5rem;
    color: #666;
}

.pulse {
    display: inline-block;
    position: relative;
    margin-right: 10px;
    width: 10px;
    height: 10px;
}

.pulse-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgb(74, 222, 128);
    will-change: transform;
    animation: framer-pulse 2s infinite;
}

.pulse-fixed {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgb(74, 222, 128);
}

.pulse-content {
    /* Vuoto */
}

@keyframes framer-pulse {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(2.8745) rotate(337.409deg);
        opacity: 0;
    }
}

.icon-button {
    position: fixed;
    bottom: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: transform 0.2s;
}

.icon-button:hover {
    transform: scale(1.05);
}

#githubIcon {
    right: 200px;
    background-color: #333;
}

#backIcon {
    left: 20px;
    background-color: #1b912b;
}

#scheduleIcon {
    right: 140px;
    background-color: #1b912b;
}

#settingsIcon {
    right: 80px;
    background-color: #1b912b;
}

#infoIcon {
    right: 20px;
    background-color: #1b912b;
}

.overlay {
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(10px);
    transition: opacity 0.25s ease;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background-color: white;
    border-radius: 20px;
    z-index: 1001;
    max-width: 600px;
    width: 90%;
    transition: all 0.25s ease;
}

#settingsModal, #infoModal, #scheduleModal {
    padding: 30px;
    text-align: left;
}

.settings-content {
    margin-bottom: 20px;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section h4 {
    margin-bottom: 10px;
    color: #333;
}

.settings-content label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
}

#weightSelect {
    display: none;
}

.settings-content select {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 25px;
    font-family: 'Montserrat', sans-serif;
    background-color: #f9f9f9;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.settings-content button {
    width: 100%;
    padding: 12px;
    margin-top: 5px;
    border: none;
    border-radius: 20px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.toggle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.toggle-label {
    font-weight: normal;
    color: #333;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 14px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #1b912b;
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

#forceSync {
    background-color: #d63031;
    color: white;
    border-radius: 25px;
    transition: transform 0.3s ease;
}

#forceSync:hover {
    transform: scale(1.01);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.modal-footer button {
    border-radius: 20px;
    padding: 10px 20px;
}

#infoModal h3 {
    margin-bottom: 20px;
}

#infoModal p {
    line-height: 1.6;
    margin-bottom: 20px;
}

#infoModal .modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

button {
    margin: 0 5px;
    padding: 8px 16px;
    border: none;
    border-radius: 50px;
    background-color: #1b912b;
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
    transition: transform 0.3s ease;
}

button:hover {
    transform: scale(1.04);
}

.icon-button i {
    font-size: 1.55rem;
}

/* --- REGOLE WIDGET PILLOLA (CORRETTE) --- */
#status-pill {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    height: 50px;
    background-color: white;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90%;
    
    /* Transizione fluida per larghezza e opacità */
    transition: width 0.4s ease-in-out, opacity 0.4s ease;
    
    /* Stato di default (stretto, per la barra di progresso) */
    width: 250px; 
    padding: 0 20px;
}

#status-pill.sync-view {
    /* Stato espanso: la larghezza si adatta al contenuto. `auto` è la chiave. */
    width: auto;
}

#sync-status {
    white-space: nowrap; /* Fondamentale: impedisce al testo di andare a capo */
    text-align: center;
}

.widget-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Modifica chiave: Rimuoviamo position:absolute per permettere al contenitore di adattarsi */
.widget-content {
    display: none; /* Nascosto di default */
    width: 100%;
    align-items: center;
    justify-content: center;
}

.widget-content.active {
    display: flex; /* Mostrato quando attivo, entra nel flusso del layout */
}

#schedule-widget {
    flex-direction: column;
    gap: 5px;
    align-items: stretch;
}

.schedule-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: bold;
}

.progress-bar-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

#materia-progress {
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: width 0.5s ease-out, background-color 0.5s ease;
}

.schedule-table-container {
    margin-bottom: 20px;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
}

.schedule-table th, .schedule-table td {
    padding: 10px;
    text-align: center;
    border: 1px solid #ddd;
}

.schedule-table th {
    background-color: #1b912b;
    color: white;
    font-weight: bold;
}

.schedule-table td {
    background-color: white;
    color: black;
}

.schedule-table .current-day {
    background-color: #5C5C5C !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    #githubIcon, #settingsIcon, #scheduleIcon, #status-pill {
        display: none;
    }

    .clock {
        font-size: 4rem;
    }

    .schedule-table {
        font-size: 0.8rem;
    }

    .schedule-table th, .schedule-table td {
        padding: 5px;
    }
}

/* Desktop and tablet adjustments */
@media (min-width: 769px) {
    #scheduleModal {
        width: 90%;
        max-width: none;
        max-height: 90vh;
        overflow-y: auto;
    }

    .schedule-table {
        font-size: 1rem;
    }

    .schedule-table th, .schedule-table td {
        padding: 15px;
    }
}
