/* === STILI PER LA SEZIONE GLICEMIA === */

.glucose-checker-section {
    position: relative;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.glucose-checker-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary-500), var(--color-primary-600));
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.glucose-checker-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.glucose-checker-form input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--color-primary-100);
    border-radius: 10px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glucose-checker-form input:hover {
    border-color: var(--color-primary-200);
    background: rgba(255, 255, 255, 0.95);
}

.glucose-checker-form input:focus {
    outline: none;
    border-color: var(--color-primary-500);
    background: white;
    box-shadow: 0 0 0 3px var(--color-primary-100);
}

.glucose-checker-form button {
    position: relative;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.glucose-checker-form button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.glucose-checker-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--color-primary-200);
}

.glucose-checker-form button:hover::before {
    left: 100%;
}

.glucose-checker-form button:active {
    transform: translateY(0);
}

.glucose-result {
    margin: 20px 0;
    padding: 20px;
    border-radius: 12px;
    border-left: 5px solid;
    animation: slideIn 0.3s ease-out;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.glucose-result.normal {
    background: #f0fff4;
    border-color: #38a169;
    color: #2d3748;
}

.glucose-result.prediabetes {
    background: #fffbf0;
    border-color: #ed8936;
    color: #2d3748;
}

.glucose-result.diabetes {
    background: #fff5f5;
    border-color: #e53e3e;
    color: #2d3748;
}

.glucose-result.low {
    background: #ebf8ff;
    border-color: #3182ce;
    color: #2d3748;
}

.glucose-result-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.glucose-result-header {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-size: 24px;
    font-weight: bold;
}

.glucose-result-value {
    font-size: 32px;
}

.glucose-result-unit {
    font-size: 18px;
    opacity: 0.7;
}

.glucose-result-category {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 5px;
}

.glucose-result-description {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.glucose-result-advice {
    font-size: 14px;
    font-style: italic;
    opacity: 0.8;
}

.glucose-ranges-info {
    margin-top: 30px;
    padding: 20px;
    background: rgba(247, 250, 252, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.glucose-ranges-info h4 {
    margin: 0 0 15px 0;
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 18px;
    font-weight: 700;
}

.glucose-ranges {
    display: grid;
    gap: 10px;
    margin-bottom: 15px;
}

.glucose-range {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-radius: 10px;
    border-left: 4px solid;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glucose-range:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.glucose-range.normal {
    background: #f0fff4;
    border-color: #38a169;
}

.glucose-range.prediabetes {
    background: #fffbf0;
    border-color: #ed8936;
}

.glucose-range.diabetes {
    background: #fff5f5;
    border-color: #e53e3e;
}

.range-label {
    font-weight: 600;
    color: #2d3748;
}

.range-values {
    font-family: monospace;
    font-weight: bold;
    color: #4a5568;
}

.glucose-disclaimer {
    font-size: 12px;
    color: #718096;
    font-style: italic;
    margin: 0;
    text-align: center;
}

.glucose-note {
    font-size: 14px;
    color: #e53e3e;
    margin: 10px 0;
    padding: 8px 12px;
    background: #fff5f5;
    border-radius: 6px;
    border-left: 3px solid #e53e3e;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .glucose-checker-form {
        flex-direction: column;
    }
    
    .glucose-checker-form input,
    .glucose-checker-form button {
        width: 100%;
    }
    
    .glucose-result-header {
        font-size: 20px;
    }
    
    .glucose-result-value {
        font-size: 28px;
    }
}
/* === STILI PER LO STORICO GLICEMIA === */

.glucose-history-section {
    position: relative;
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.glucose-history-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary-500), var(--color-primary-600));
    animation: shimmer 3s infinite;
}

.glucose-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.glucose-history-header h4 {
    margin: 0;
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 18px;
    font-weight: 700;
}

.glucose-history-buttons {
    display: flex;
    gap: 10px;
}

.glucose-history-toggle-btn,
.export-btn {
    position: relative;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.glucose-history-toggle-btn::before,
.export-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.glucose-history-toggle-btn {
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
    color: white;
}

.glucose-history-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--color-primary-200);
}

.glucose-history-toggle-btn:hover::before {
    left: 100%;
}

.export-btn {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    color: white;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(56, 161, 105, 0.4);
}

.export-btn:hover::before {
    left: 100%;
}

.glucose-history-content {
    transition: all 0.3s ease;
}

.glucose-history-content.hidden {
    display: none;
}

.glucose-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.glucose-history-list::-webkit-scrollbar {
    width: 8px;
}

.glucose-history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.glucose-history-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
    border-radius: 10px;
}

.glucose-history-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-700));
}

.glucose-history-item {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}

.glucose-history-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: inherit;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glucose-history-item:hover {
    transform: translateX(8px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.glucose-history-item:hover::before {
    width: 6px;
}

.glucose-history-item.normal {
    background: #f0fff4;
    border-color: #38a169;
}

.glucose-history-item.prediabetes {
    background: #fffbf0;
    border-color: #ed8936;
}

.glucose-history-item.diabetes {
    background: #fff5f5;
    border-color: #e53e3e;
}

.glucose-history-item.low {
    background: #ebf8ff;
    border-color: #3182ce;
}

.glucose-history-date {
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

.glucose-history-value {
    font-family: monospace;
    font-weight: bold;
    font-size: 16px;
    color: #2d3748;
}

.glucose-history-category {
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    text-align: center;
}

.edit-glucose-btn,
.delete-glucose-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.6;
}

.edit-glucose-btn:hover {
    background: linear-gradient(135deg, #bee3f8 0%, #90cdf4 100%);
    opacity: 1;
    transform: scale(1.15) rotate(-5deg);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.delete-glucose-btn:hover {
    background: linear-gradient(135deg, #fed7d7 0%, #fc8181 100%);
    opacity: 1;
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.no-data {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 40px 20px;
}

/* Aggiornamento form per includere il pulsante Salva */
.glucose-checker-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.glucose-checker-form input {
    flex: 2;
    min-width: 200px;
}

.glucose-checker-form button {
    flex: 1;
    min-width: 100px;
}

#save-glucose-btn {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

#save-glucose-btn:hover {
    box-shadow: 0 8px 20px rgba(56, 161, 105, 0.4);
}

#save-glucose-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    opacity: 0.6;
}

#save-glucose-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Responsive per storico glicemia */
@media (max-width: 768px) {
    .glucose-history-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .glucose-history-buttons {
        justify-content: center;
    }
    
    .glucose-history-item {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
    }
    
    .glucose-history-date {
        font-size: 16px;
        margin-bottom: 5px;
    }
    
    .glucose-history-value {
        font-size: 20px;
        margin-bottom: 5px;
    }
    
    .glucose-history-category {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .delete-glucose-btn {
        justify-self: center;
    }
    
    .glucose-checker-form {
        flex-direction: column;
    }
    
    .glucose-checker-form input,
    .glucose-checker-form button {
        width: 100%;
        min-width: unset;
    }
}