html,
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    box-sizing: border-box;
    min-height: 100vh;
    background-color: #f4f4f5;
}

h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5em;
    font-weight: bold;
}

h1 del+span {
    color: #27ae60;
    font-weight: bold;
}

#add-link-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color .3s;
}

#add-link-btn:hover {
    background-color: #2980b9;
}

#link-list {
    margin-top: 30px;
}

.link-item h3 {
    margin-top: 0;
    color: #2c3e50;
}

.link-item p {
    margin: 10px 0;
    color: #7f8c8d;
}

.link-item a {
    color: #3498db;
    text-decoration: none;
}

.link-item button {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color .3s;
}

.link-item button:hover {
    background-color: #27ae60;
}

.accordion {
    margin-top: 20px;
}

.accordion-item {
    margin-top: 10px;
    border-top: 1px solid #ddd;
    width: 100%;
}

.accordion-header {
    background-color: #f1f3f5;
    padding: 10px 15px;
    cursor: pointer;
    border: 1px solid #e9ecef;
    border-radius: 4px 4px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.accordion-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.accordion-content {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 0 0 4px 4px;
    border: 1px solid #e9ecef;
    border-top: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease-out, padding .3s ease;
    width: 100%;
    box-sizing: border-box;
}

.accordion-item.active .accordion-content {
    padding: 15px;
    max-height: none;
}

.accordion-item:not(.active) .accordion-content {
    padding-top: 0;
    padding-bottom: 0;
}

.accordion-content p {
    margin: 15px 0;
}

.accordion-icon {
    transition: transform .3s ease;
}

.markdown-content {
    line-height: 1.6;
    width: 100%;
    box-sizing: border-box;
}

.markdown-content>* {
    max-width: 100%;
    box-sizing: border-box;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1em;
    margin-bottom: .5em;
}

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.markdown-content li {
    margin-bottom: .5em;
}

.markdown-content code {
    background-color: #f4f4f4;
    padding: .2em .4em;
    border-radius: 3px;
    font-family: monospace;
}

.markdown-content pre {
    background-color: #f4f4f4;
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
}

.markdown-content blockquote {
    border-left: 4px solid #ccc;
    padding-left: 1em;
    margin-left: 0;
    color: #666;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

#addLinkForm label {
    margin-top: 10px;
}

#addLinkForm input,
#addLinkForm select {
    margin-bottom: 10px;
    padding: 5px;
}

#addLinkForm button {
    margin-top: 10px;
    padding: 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
}

#loadingIcon {
    position: fixed;
    top: 2%;
    left: 70%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px;
    border-radius: 5px;
    z-index: 1000;
}

.link-checkbox {
    position: relative;
    padding-left: 30px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 16px;
    user-select: none;
    margin-right: 10px;
    display: flex;
    align-items: center;
}

.link-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 22px;
    width: 22px;
    background-color: #fff;
    border: 2px solid #ccc;
    border-radius: 4px;
}

.link-checkbox input:checked~.checkmark {
    background-color: #2196F3;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.link-checkbox .checkmark:after {
    left: 8px;
    top: 4px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

#podcast-section {
    background-color: #f0f0f0;
    border-radius: 8px;
    padding: 15px;
    margin: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
}

#podcast-player {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}

#podcast-player h2 {
    margin-bottom: 15px;
    color: #333;
}

#podcast-select {
    width: 100%;
    margin-bottom: 15px;
    background-color: white;
    color: #333;
    flex: 1;
    min-width: 200px;
    max-width: 100%;
    margin-right: 10px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.player-controls {
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#audio-player {
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
    flex-grow: 1;
    margin-right: 15px;
}

.custom-buttons-container {
    gap: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

.custom-button {
    background-color: #4CAF50;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .3s;
}

.push-to-talk-button.recording {
    background-color: #ff4d4d;
}

.custom-button:active {
    opacity: 0.8;
}

audio::-webkit-media-controls-play-button {
    background-color: #007bff;
    border-radius: 50%;
}

audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
    color: #333;
}

.delete-podcast-button {
    margin-left: 10px;
    border-radius: 5px;
    background-color: transparent;
    color: #e74c3c;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: color .3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-podcast-button:hover {
    background-color: #ff1a1a;
    color: #c0392b;
}

.loading-icon {
    position: fixed;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    z-index: 1000;
    max-width: 250px;
    pointer-events: none;
}

#generatePodcastForm button[type="submit"] {
    background-color: #4CAF50;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.manual-content-textarea {
    width: calc(100%-20px);
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 150px;
    transition: border-color .3s ease;
    box-sizing: border-box;
}

.manual-content-textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.link-item.read {
    opacity: 0.7;
    background-color: #f0f0f0;
}

#read-links-toggle {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
}

.link-actions button {
    margin-right: 5px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: #f0f0f0;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s ease;
}

.search-container {
    margin: 20px 0;
    justify-content: center;
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

#searchInput {
    width: 100%;
    max-width: 600px;
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.link-item {
    padding: 8px 12px;
    min-height: auto;
    gap: 4px;
    border: 1px solid #ddd;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.link-checkbox input[type="checkbox"] {
    margin-right: 5px;
}

.link-header h3 {
    flex-grow: 1;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    font-size: 0.95em;
    line-height: 1.3;
}

.link-info {
    justify-content: space-between;
    color: #666;
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-size: 0.85em;
}

.link-category {
    font-weight: bold;
}

.link-date {
    margin: 0 10px;
}

.link-url {
    color: #007bff;
    text-decoration: none;
}

.link-actions {
    flex-wrap: wrap;
    margin-top: 10px;
    display: flex;
    gap: 6px;
    margin: 0;
    flex-shrink: 0;
}

button,
.link-checkbox,
.accordion-header {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

input,
select,
textarea {
    box-sizing: border-box;
}

* {
    max-width: 100%;
}

#addLinkModal .accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease-out, padding .3s ease, opacity .3s ease;
    opacity: 0;
    padding: 0 15px;
}

#addLinkModal .accordion-content.active {
    opacity: 1;
    padding: 15px;
}

#addLinkModal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    max-width: 500px;
}

#manualContent {
    width: 100%;
    min-height: 100px;
    resize: vertical;
}

#custom-play-pause {
    background-color: #4CAF50;
    margin-right: 10px;
}

.push-to-talk-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .3s opacity .3s;
}

.push-to-talk-button:disabled {
    background-color: #cccccc !important;
    cursor: not-allowed;
    opacity: 0.6;
}

#generatePodcastForm label {
    margin-top: 10px;
    margin-bottom: 5px;
    font-weight: bold;
}

#generatePodcastForm select,
#generatePodcastForm button {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 16px;
}

#generatePodcastForm button {
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color .3s;
}

#response-player {
    display: block;
    width: 100%;
    margin-top: 15px;
}

#audio-player,
#response-player {
    width: 100%;
}

.search-container input[type="text"] {
    width: 100%;
    padding: 10px 15px;
    margin: 8px 0;
    box-sizing: border-box;
    border: 2px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

.chat-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

#chat-play {
    background-color: #4CAF50;
    margin-right: 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 10px auto;
}

100% {
    transform: rotate(360deg);
}

.custom-button,
.push-to-talk-button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-clip: padding-box;
    position: relative;
    overflow: hidden;
}

.custom-button i,
.push-to-talk-button i {
    font-size: 36px;
    position: relative;
    z-index: 2;
}

.custom-button::after,
.push-to-talk-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    border-radius: 50%;
}

.custom-button i,
.push-to-talk-button i,
#chatBotModal .custom-button i,
#chatBotModal .push-to-talk-button i {
    display: inline-block !important;
    vertical-align: middle;
}

.chat-button {
    background-color: #3498db;
}

.star-rating {
    font-size: 0;
    display: inline-block;
}

.star-rating span {
    font-size: 20px;
    padding: 0 1px;
    color: #ddd;
    cursor: pointer;
}

.star-filter {
    display: flex;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 20px;
    padding: 5px 15px;
}

.star-filter label {
    font-size: 14px;
    margin-right: 10px;
    color: #555;
}

.star-filter-options {
    display: flex;
    gap: 5px;
}

.star-filter-option {
    cursor: pointer;
    font-size: 24px;
    color: #ddd;
    transition: color .3s ease;
}

.star-filter-option:hover {
    color: #ffd700;
}

.podcast-controls {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.delete-podcast-button i {
    font-size: 18px;
}

.tab-button {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    position: relative;
}

.tab-button.active {
    color: #4CAF50;
    font-weight: bold;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #4CAF50;
}

.tab-content {
    display: none;
}

.access-stats-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
    height: auto;
    min-height: 500px;
}

.access-stats-section {
    flex: 1;
    min-width: 300px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 500px;
    display: flex;
    flex-direction: column;
}

.download-button {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tooltip:disabled:hover::after {
    content: "Seleziona almeno un articolo per generare il podcast";
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px;
    background-color: #333;
    color: white;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 1000;
}

.tooltip:disabled:hover::before {
    content: "";
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent;
    z-index: 1000;
}

.users-controls {
    margin-bottom: 20px;
}

.add-user-button {
    margin-bottom: 20px;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.user-actions {
    display: flex;
    gap: 10px;
}

.change-password-button,
.delete-user-button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.delete-user-button:hover {
    background-color: #d32f2f;
}

.navbar {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: .5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.navbar-brand h1 {
    margin: 0;
    font-size: 1.2rem;
    color: #2c3e50;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: .5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1rem;
    transition: background-color .3s ease;
}

#app {
    padding-top: 80px;
    min-height: calc(100vh-80px);
    display: flex;
    flex-direction: column;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 8px 0;
    z-index: 1001;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    color: #333;
    font-size: 14px;
    text-align: left;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
}

#userButton {
    background-color: #2196F3;
    padding: .5rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#changePasswordModal .modal-content {
    max-width: 400px;
}

#changePasswordForm {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#changePasswordForm .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#changePasswordForm label {
    font-weight: 500;
    color: #333;
}

#changePasswordForm input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

#changePasswordForm input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(74, 175, 80, 0.2);
}

#changePasswordForm .form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

#changePasswordForm .submit-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color .3s;
}

.invitation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    background-color: white;
}

.invite-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

to {
    opacity: 1;
    transform: translateY(0);
}

#unread-link-list {
    min-height: 200px;
}

.quick-add-button {
    background-color: #FF9800;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 25px;
    transition: background-color .3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    min-width: 200px;
}

.quick-add-button:hover {
    background-color: #F57C00;
}

.button-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.link-actions button i {
    font-size: 14px;
}

.link-actions button.summary-button {
    background-color: #4CAF50;
    color: white;
}

.link-actions button.chat-button {
    background-color: #9C27B0;
    color: white;
}

.link-actions button.debug-button {
    background-color: #FF9800;
    color: white;
}

.link-actions button:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.link-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.link-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}

h1 del,
.navbar-brand h1 del {
    color: #e74c3c;
    text-decoration: line-through;
    font-weight: normal;
}

.link-item a:hover,
.link-url:hover {
    text-decoration: underline;
}

.add-link-button,
#generatePodcastButton {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 25px;
    transition: background-color .3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    min-width: 200px;
}

.add-link-button:hover,
#addLinkForm button:hover,
#generatePodcastButton:hover:not(:disabled),
#custom-play-pause:hover,
.push-to-talk-button:hover,
#generatePodcastForm button[type="submit"]:hover,
#chatForm button:hover,
#custom-play-pause:hover,
.push-to-talk-button:hover:not(:disabled),
#generatePodcastForm button:hover,
#chat-play:hover,
.add-user-button:hover,
.nav-button:hover,
#changePasswordForm .submit-button:hover,
.invite-button:hover {
    background-color: #45a049;
}

.add-link-button i,
#generatePodcastButton i,
.quick-add-button i {
    margin-right: 10px;
}

.accordion-item.active .accordion-icon,
.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

#addLinkForm,
#generatePodcastForm {
    display: flex;
    flex-direction: column;
}

#generatePodcastButton:disabled,
#chat-play:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.link-checkbox:hover input~.checkmark,
audio::-webkit-media-controls-panel {
    background-color: #f8f8f8;
}

.link-checkbox input:checked~.checkmark:after,
.tab-content.active,
.user-menu:hover .user-dropdown {
    display: block;
}

#generatePodcastModal .modal-content,
#chatBotModal .modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.push-to-talk-button:disabled:hover,
#chat-play:disabled:hover {
    background-color: #cccccc;
}

.star-rating span.active,
.star-filter-option.active {
    color: #ffcc00;
}

.download-button:hover,
.change-password-button:hover,
#userButton:hover {
    background-color: #1976D2;
}

.tooltip,
.user-menu {
    position: relative;
}

.users-list,
.invitations-list {
    background-color: white;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-item:last-child,
.invitation-item:last-child {
    border-bottom: none;
}

.user-info,
.invitation-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.username,
.invitation-info .email {
    font-size: 16px;
    font-weight: 500;
}

.last-access,
.invitation-info .date {
    font-size: 14px;
    color: #666;
}

.change-password-button,
.link-actions button.mark-button {
    background-color: #2196F3;
    color: white;
}

.delete-user-button,
.link-actions button.delete-button {
    background-color: #f44336;
    color: white;
}

@media max-width 768px {
    #podcast-section {
        margin: 10px;
        padding: 15px;
    }

    .podcast-controls {
        flex-direction: column;
    }

    #podcast-select {
        margin-right: 0;
        width: 100%;
        margin-bottom: 10px;
    }

    .custom-buttons-container {
        width: 100%;
        justify-content: center;
        gap: 15px;
    }

    #audio-player {
        margin-right: 0;
        margin-bottom: 10px;
        width: 100%;
    }

    .player-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .push-to-talk-button {
        align-self: center;
    }

    h1 {
        font-size: 2em;
    }

    .add-link-button,
    #generatePodcastButton {
        width: 100%;
        margin-bottom: 10px;
    }

    #link-list {
        margin-top: 20px;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
    }

    #podcast-player {
        width: 100%;
    }

    #addLinkForm input,
    #addLinkForm select,
    #generatePodcastForm select {
        width: 100%;
        padding: 10px;
        margin-bottom: 15px;
    }

    #addLinkForm button,
    #generatePodcastForm button {
        width: 100%;
        padding: 12px;
    }

    body,
    .accordion-content {
        padding: 10px;
    }

    .link-item,
    .accordion-header {
        padding: 15px;
    }
}

@media max-width 480px {
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.8em;
    }

    .link-item h3 {
        font-size: 1.2em;
    }
}

@media hover none {

    .add-link-button,
    #generatePodcastButton,
    .link-item button {
        padding: 12px 20px;
    }

    .link-checkbox .checkmark {
        width: 30px;
        height: 30px;
    }

    .link-checkbox .checkmark:after {
        left: 11px;
        top: 7px;
        width: 6px;
        height: 12px;
    }
}

@media screen and max-width 600px {
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }

    .modal-content h2 {
        font-size: 1.2em;
    }

    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        width: 100%;
        padding: 8px;
        margin-bottom: 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-sizing: border-box;
    }

    .modal-content button {
        width: 100%;
    }

    #generatePodcastForm select,
    #generatePodcastForm button[type="submit"],
    #addLinkForm input,
    #addLinkForm select,
    #addLinkForm button,
    #chatForm input,
    #chatForm button {
        width: 100%;
        box-sizing: border-box;
    }
}

@media screen and max-width 768px {

    input[type="text"],
    input[type="url"],
    input[type="email"],
    input[type="password"],
    textarea {
        font-size: 16px;
    }

    select {
        font-size: 16px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        padding-right: 20px;
        background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='002424' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M710l555-5z'/><path d='M00h24v24H0z' fill='none'/></svg>");
        background-repeat: no-repeat;
        background-position-x: 100%;
        background-position-y: 5px;
    }

    button {
        padding: 12px 20px;
        font-size: 16px;
        max-width: 100%;
        white-space: normal;
    }

    input[type="checkbox"] {
        transform: scale(1.5);
        margin-right: 10px;
    }

    .link-item {
        padding: 15px;
        margin-bottom: 15px;
    }

    .modal-content {
        width: 90%;
        padding: 15px;
    }

    body {
        font-size: 16px;
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    h3 {
        font-size: 18px;
    }

    .link-item,
    .modal-content,
    #podcast-section,
    #audio-player,
    .search-container,
    #searchInput,
    .add-link-button,
    #generatePodcastButton,
    .button-container,
    h1,
    #link-list,
    #unread-link-list,
    #read-link-list,
    #read-links-section {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .link-item {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    .link-item,
    .modal-content {
        padding: 10px;
    }

    #generatePodcastModal .modal-content {
        width: 95%;
        margin: 5% auto;
    }

    .add-link-button {
        padding: 12px 24px;
        font-size: 14px;
    }

    .add-link-button i {
        margin-right: 8px;
    }

    .navbar {
        padding: .5rem;
    }

    .navbar-brand h1 {
        font-size: 1.1rem;
    }

    .nav-button {
        padding: .3rem .6rem;
        font-size: .9rem;
    }

    .user-item {
        flex-direction: column;
        gap: 10px;
    }

    .quick-add-button,
    .add-link-button,
    #generatePodcastButton {
        width: 100%;
        min-width: 0;
    }

    .link-details {
        flex-direction: column;
        align-items: flex-start;
    }

    .link-info {
        margin-bottom: 8px;
    }

    #chatBotModal .custom-button,
    #chatBotModal .push-to-talk-button,
    #chatBotModal .custom-button,
    #chatBotModal .push-to-talk-button,
    .custom-button,
    .push-to-talk-button {
        width: 80px;
        height: 80px;
    }

    #chatBotModal .custom-button i,
    #chatBotModal .push-to-talk-button i,
    #chatBotModal .custom-button i,
    #chatBotModal .push-to-talk-button i,
    .custom-button i,
    .push-to-talk-button i {
        font-size: 36px;
    }

    .user-actions,
    .link-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.upload-media-button {
    background-color: #9C27B0;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 25px;
    transition: background-color .3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    min-width: 200px;
}

.upload-media-button:hover {
    background-color: #7B1FA2;
}

.upload-media-button i {
    margin-right: 10px;
}

.upload-progress-container {
    margin: 20px 0;
}

.upload-progress {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #4CAF50;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 5px;
    font-size: 14px;
    color: #666;
}

#uploadMediaForm .form-group {
    margin-bottom: 20px;
}

#uploadMediaForm input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

#uploadMediaForm .submit-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

#uploadMediaForm .submit-button:hover {
    background-color: #45a049;
}

/* Aggiungi questi stili alla fine del file */
.shared-podcast-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.shared-player {
    margin: 20px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.content-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.content-box {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.summary-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.summary-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

@media (max-width: 768px) {
    .shared-podcast-container {
        padding: 10px;
    }
    
    .content-box {
        padding: 15px;
    }
}

/* Aggiungi questi stili per il link all'articolo */
.article-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2196F3;
    text-decoration: none;
    margin-top: 10px;
    font-size: 14px;
    transition: color 0.3s ease;
}

.article-link:hover {
    color: #1976D2;
    text-decoration: underline;
}

.article-link i {
    font-size: 12px;
}

/* Stile per il pulsante del comando rapido */
.shortcut-button {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.shortcut-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.shortcut-label {
    font-size: 0.9em;
}

/* Responsive: nascondi il testo su schermi piccoli */
@media (max-width: 768px) {
    .shortcut-label {
        display: none;
    }
    
    .shortcut-button {
        padding: 8px;
    }
}

/* Modifica gli stili della chat */
#chatModal .modal-content {
    width: 90%;
    max-width: 800px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    margin: 10vh auto;
    padding: 15px;
    position: relative;
    overflow: hidden;
}

#chatMessages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
}


.chat-message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 8px;
    max-width: 80%;
    line-height: 1.5;
}

.user-message {
    background-color: #e3f2fd;
    margin-left: auto;
    text-align: left;
}

.ai-message {
    background-color: #f5f5f5;
    margin-right: auto;
}

/* Stili per il markdown nella chat */
.chat-message p {
    margin: 0 0 10px 0;
}

.chat-message p:last-child {
    margin-bottom: 0;
}

.chat-message code {
    background-color: #f0f0f0;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

.chat-message pre {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 10px 0;
}

.chat-message blockquote {
    border-left: 4px solid #ddd;
    margin: 10px 0;
    padding-left: 10px;
    color: #666;
}

.chat-message ul, 
.chat-message ol {
    margin: 10px 0;
    padding-left: 20px;
}

.chat-message img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
}

#chatForm {
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 10px;
    padding: 10px;
    background-color: #fff;
    border-top: 1px solid #ddd;
    min-height: 60px;
}

#chatInput {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    min-height: 40px;
    max-height: 100px;
    resize: none;
}

#chatForm button {
    padding: 8px 16px;
    min-width: 60px;
    height: 40px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stili specifici per mobile */
@media (max-width: 768px) {
    #chatModal .modal-content {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        padding: 10px;
        /* Rimuovi il margine superiore per sfruttare tutto lo spazio */
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        position: fixed;
    }

    #chatMessages {
        /* Calcola l'altezza disponibile sottraendo l'altezza di header e form */
        height: calc(100vh - 130px);
        overflow-y: auto;
        padding: 10px;
        margin-bottom: 10px;
    }

    #chatForm {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 10px;
        border-top: 1px solid #ddd;
        /* Assicurati che il form rimanga sopra il contenuto */
        z-index: 2;
    }

    /* Aggiusta il padding del contenuto per evitare che venga nascosto sotto il form */
    #chatModal .modal-content {
        padding-bottom: 70px;
    }

    /* Gestisci meglio l'altezza quando la tastiera è aperta */
    @media (max-height: 500px) {
        #chatModal .modal-content {
            height: 100%;
        }

        #chatMessages {
            height: calc(100vh - 140px);
        }
    }
}

/* Per dispositivi molto piccoli */
@media (max-width: 320px) {
    #chatModal .modal-content {
        padding: 8px;
    }

    #chatMessages {
        padding: 8px;
        /* Aggiusta l'altezza per dispositivi più piccoli */
        height: calc(100vh - 120px);
    }

    #chatForm {
        padding: 8px;
    }
}

.files-popup {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 15px;
    margin-top: 5px;
}

.files-popup-content {
    max-width: 300px;
}

.files-popup h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-link {
    display: flex;
    align-items: center;
    padding: 8px;
    text-decoration: none;
    color: #333;
    background: #f5f5f5;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.file-link:hover {
    background: #e0e0e0;
}

.file-link i {
    margin-right: 8px;
}

.link-url {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.link-url:hover {
    color: #007bff;
}

.editable {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.editable:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.editable.editing {
    background-color: rgba(0, 0, 0, 0.02);
}

.editable-textarea {
    width: 100%;
    min-height: inherit;
    height: auto;
    padding: inherit;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    background: transparent;
    border: none;
    resize: none;
    overflow: hidden;
    box-shadow: none;
    outline: none;
}

.editable-controls {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
    position: absolute;
    right: 8px;
    top: 8px;
    background: white;
    padding: 4px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 100;
}

.editable-controls button {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

/* Stili specifici per mobile */
@media (max-width: 768px) {
    .editable-controls {
        position: absolute;
        top: 8px;
        right: 8px;
        padding: 4px;
        z-index: 100;
    }

    .editable-controls button {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .editable.editing {
        padding-right: 90px;
        min-height: 44px;
    }

    .editable-textarea {
        padding-right: 90px;
    }
}

/* Previeni lo zoom su doppio tap */
* {
    touch-action: manipulation;
}

.editable {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Applica a tutti i pulsanti e elementi interattivi */
button,
.link-checkbox,
.accordion-header,
.link-url,
.file-link {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.add-category-button {
    display: none;
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.add-category-button i {
    margin-right: 8px;
}

@media (max-width: 768px) {
    .chosen-container {
        width: 100% !important;
    }

    .chosen-container .chosen-search input {
        font-size: 16px !important;  /* Previene lo zoom su iOS */
        padding: 12px 8px;  /* Input più grandi su mobile */
    }

    .chosen-container .chosen-results {
        max-height: 200px;
        -webkit-overflow-scrolling: touch;
    }

    .chosen-container .chosen-results li {
        padding: 12px 8px;  /* Elementi più grandi su mobile */
    }

    .add-category-button {
        padding: 12px;
        font-size: 16px;
    }
}

/* Aggiungi questo stile per il padding del fondo pagina */
#read-links-section {
    margin-bottom: 50px;  /* Spazio sotto la sezione dei link letti */
    padding-bottom: 30px; /* Padding aggiuntivo */
}

/* Per assicurarci che ci sia sempre spazio anche su mobile */
@media (max-width: 768px) {
    #read-links-section {
        margin-bottom: 70px;  /* Spazio maggiore su mobile */
        padding-bottom: 50px;
    }
}

/* Per gestire meglio lo spazio quando la tastiera è aperta su mobile */
@media (max-height: 600px) {
    #read-links-section {
        margin-bottom: 30px;
        padding-bottom: 20px;
    }
}

/* Stili per i checkbox su mobile */
.link-checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: absolute;
    opacity: 0;
}

.link-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 22px;
    width: 22px;
    background-color: #fff;
    border: 2px solid #ccc;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Stile quando il checkbox è selezionato */
.link-checkbox input[type="checkbox"]:checked ~ .checkmark {
    background-color: #2196F3;
    border-color: #2196F3;
}

/* Stile quando il checkbox è in focus o active */
.link-checkbox input[type="checkbox"]:focus ~ .checkmark,
.link-checkbox input[type="checkbox"]:active ~ .checkmark {
    background-color: #2196F3;
    border-color: #2196F3;
}

/* Stile per il segno di spunta */
.link-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 8px;
    top: 4px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* Mostra il segno di spunta quando selezionato */
.link-checkbox input[type="checkbox"]:checked ~ .checkmark:after {
    display: block;
}

/* Stili specifici per mobile */
@media (max-width: 768px) {
    .link-checkbox input[type="checkbox"]:active ~ .checkmark,
    .link-checkbox input[type="checkbox"]:focus ~ .checkmark {
        background-color: #2196F3;
        border-color: #2196F3;
    }

    /* Forza il colore anche durante il tap */
    .link-checkbox input[type="checkbox"]:checked ~ .checkmark {
        background-color: #2196F3 !important;
        border-color: #2196F3 !important;
    }

    /* Rimuovi l'evidenziazione tap su iOS */
    .link-checkbox {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Stili per le cartelle dei link letti */
.category-container {
    margin-bottom: 8px;
}

.category-header {
    background-color: #f8f9fa;
    padding: 15px;  /* Aumentato da valori precedenti */
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.category-header:hover {
    background-color: #e9ecef;
}

.category-header:active {
    background-color: #dee2e6;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;  /* Aumentato lo spazio tra icona e testo */
    font-size: 1.1em;  /* Aumentato il font size */
    color: #333;
}

.category-title i {
    font-size: 1.2em;  /* Icona più grande */
    color: #666;
    width: 24px;  /* Larghezza fissa per allineamento */
    text-align: center;
}

.category-content {
    padding: 0 15px;
    margin-top: 8px;
}

/* Stili specifici per mobile */
@media (max-width: 768px) {
    .category-header {
        padding: 18px 15px;  /* Padding verticale ancora più grande su mobile */
    }

    .category-title {
        font-size: 1.15em;  /* Font leggermente più grande su mobile */
        gap: 15px;  /* Più spazio tra icona e testo su mobile */
    }

    .category-title i {
        font-size: 1.3em;  /* Icona ancora più grande su mobile */
        width: 28px;  /* Area tappabile più grande */
    }

    /* Aggiungi spazio tra le categorie su mobile */
    .category-container {
        margin-bottom: 12px;
    }

    /* Feedback visivo al tap */
    .category-header:active {
        background-color: #dee2e6;
        transform: scale(0.98);
    }
}

/* Stili per il conteggio dei link */
.category-title span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Stile per il contatore */
.category-title span::after {
    content: attr(data-count);
    font-size: 0.9em;
    color: #666;
    background-color: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 5px;
}

/* Aggiungi questi stili per il link cliccabile e l'effetto highlight */
.podcast-article-item {
    cursor: pointer;
    transition: all 0.2s ease;
}

.podcast-article-item:hover {
    background-color: #f0f0f0;
    transform: translateX(5px);
}

.podcast-article-item:active {
    transform: translateX(2px);
}

/* Effetto highlight per il link trovato */
@keyframes highlightLink {
    0% { background-color: #fff; }
    50% { background-color: #e3f2fd; }
    100% { background-color: #fff; }
}

.highlight-link {
    animation: highlightLink 2s ease;
}

/* Aggiungi questi stili per il campo emphasis */
#generatePodcastForm textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#generatePodcastForm textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(74, 175, 80, 0.2);
}

#generatePodcastForm textarea::placeholder {
    color: #999;
    font-style: italic;
    font-size: 0.9em;
}

/* Stili specifici per mobile */
@media (max-width: 768px) {
    #generatePodcastForm textarea {
        font-size: 16px; /* Previene lo zoom su iOS */
        padding: 12px;
        min-height: 100px;
    }
}

.message-container {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.message-content {
    flex: 1;
}

.add-to-deepening {
    background: none;
    border: none;
    color: #4CAF50;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.add-to-deepening:hover {
    opacity: 1;
    background-color: rgba(76, 175, 80, 0.1);
}

.message-container:hover .add-to-deepening {
    opacity: 1;
}

/* Stili per mobile */
@media (max-width: 768px) {
    .add-to-deepening {
        width: 32px;
        height: 32px;
        opacity: 1;
    }
}

.deepening-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.deepening-section h4 {
    margin-bottom: 15px;
    color: #333;
}

.deepening-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.deepening-item {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    position: relative;
}

.deepening-question {
    margin-bottom: 10px;
    color: #2196F3;
}

.deepening-answer {
    color: #4CAF50;
}

.delete-deepening {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.delete-deepening:hover {
    opacity: 1;
    background-color: rgba(220, 53, 69, 0.1);
}

.deepening-item:hover .delete-deepening {
    opacity: 1;
}

/* Stili per mobile */
@media (max-width: 768px) {
    .deepening-item {
        padding: 12px;
    }

    .delete-deepening {
        opacity: 1;
        padding: 8px;
    }
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.regenerate-summary {
    background: none;
    border: none;
    color: #4CAF50;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.regenerate-summary:hover {
    background-color: rgba(76, 175, 80, 0.1);
}

.regenerate-summary i {
    font-size: 16px;
}

#regenerateInstructions {
    width: 100%;
    min-height: 100px;
    margin: 15px 0;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
}

.new-summary {
    max-height: 60vh;
    overflow-y: auto;
    padding: 15px;
    margin: 15px 0;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.primary-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.secondary-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.podcast-button {
    background-color: #9C27B0;
    color: white;
}

.podcast-select-item {
    padding: 15px;
    border-radius: 8px;
    background-color: #f8f9fa;
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}

.podcast-select-item:hover {
    background-color: #e9ecef;
}

.podcast-select-item i {
    color: #9C27B0;
    font-size: 1.2em;
}

.podcast-list {
    margin-top: 20px;
}

.view-mode-toggle-container {
    display: flex;
    justify-content: flex-end;
    margin: 10px 0;
}

.view-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-mode-toggle:hover {
    background-color: #e9ecef;
}

.view-mode-toggle i {
    font-size: 1.1em;
    color: #6c757d;
}

.view-mode-toggle span {
    font-size: 0.9em;
    color: #495057;
}

/* Stili per mobile */
@media (max-width: 768px) {
    .view-mode-toggle {
        padding: 6px 12px;
    }
    
    .view-mode-toggle span {
        font-size: 0.85em;
    }
}

.refresh-button {
    display: none;
}

.nav-button .fa-sync-alt {
    transition: transform 0.3s ease;
}

.nav-button:hover .fa-sync-alt {
    transform: rotate(180deg);
}

.nav-button.loading .fa-sync-alt {
    animation: spin 1s linear infinite;
}

.podcast-item-title {
    font-weight: bold;
    margin-bottom: 5px;
    cursor: pointer;
}

.podcast-title-edit {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: inherit;
    font-weight: bold;
    background-color: white;
    box-sizing: border-box;
}

.podcast-title-edit:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 3px rgba(76, 175, 80, 0.5);
}

.dropdown-item.admin-button {
    border-bottom: 1px solid #eee;
    margin-bottom: 4px;
    padding-bottom: 12px;
}

/* Stili per il pannello OpenAI Stats */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h4 {
    color: #666;
    margin: 0 0 10px 0;
    font-size: 0.9em;
    text-transform: uppercase;
}

.stat-card div {
    font-size: 1.5em;
    font-weight: bold;
    color: #2c3e50;
}

.stats-chart-container {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.stats-tables {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
}

.stats-table-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
    overflow: hidden; /* Previene lo sforamento dei contenuti */
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: auto; /* Rimuove la larghezza minima se presente */
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap; /* Mantiene il testo su una singola riga */
}

/* Stili specifici per desktop */
@media (min-width: 769px) {
    .stats-table-section {
        margin: 0 0 20px 0;
        max-width: 100%;
    }

    .table-responsive {
        border-radius: 4px;
    }
}

/* Stili per schermi più piccoli */
@media (max-width: 768px) {
    .stats-table-section {
        margin: 0 0 15px 0;
        padding: 15px;
        border-radius: 0;
    }

    .table th,
    .table td {
        padding: 8px;
        font-size: 0.9em;
    }
}

.stats-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.stats-controls input[type="date"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.stats-controls button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.stats-controls button:hover {
    background-color: #45a049;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-controls input[type="date"],
    .stats-controls button {
        width: 100%;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card div {
        font-size: 1.2em;
    }

    .table th,
    .table td {
        padding: 12px 8px;
        font-size: 0.9em;
        /* Aggiungi word-break per evitare overflow su testi lunghi */
        word-break: break-word;
    }
    
    .stats-table-section {
        padding: 15px;
        margin-bottom: 15px;
    }

    /* Nascondi alcune colonne meno importanti su mobile */
    .table th:nth-child(4),
    .table th:nth-child(5),
    .table td:nth-child(4),
    .table td:nth-child(5) {
        display: none;
    }

    /* Rendi il testo più compatto */
    .stats-table-section h3 {
        font-size: 1em;
        margin-bottom: 10px;
    }
}

/* Aggiungi questi stili per gestire il blocco dello scroll */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

#chatModal {
    -webkit-overflow-scrolling: touch; /* Per uno scrolling fluido su iOS */
}

#chatModal .modal-content {
    width: 90%;
    max-width: 800px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    margin: 10vh auto;
    padding: 15px;
    position: relative;
    overflow: hidden;
}

/* Stili specifici per mobile */
@media (max-width: 768px) {
    #chatModal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.4);
        z-index: 1000;
        overflow: hidden; /* Previene lo scroll della modale stessa */
    }

    #chatModal .modal-content {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        padding: 10px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden; /* Previene lo scroll del contenitore */
    }

    #chatMessages {
        height: calc(100vh - 130px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
        margin-bottom: 10px;
    }
}

/* Modifica gli stili dei tab dell'admin panel */
.stats-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-button {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    position: relative;
    white-space: nowrap;
    flex: 0 0 auto;
}

/* Stili specifici per mobile */
@media (max-width: 768px) {
    .stats-modal-content {
        padding: 15px;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .stats-tabs {
        padding: 10px 0;
        margin: -15px -15px 15px -15px;
        padding-left: 15px;
        padding-right: 15px;
        background: #fff;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .tab-button {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Rimuovi il bordo inferiore dai tab non attivi */
    .tab-button:not(.active)::after {
        display: none;
    }

    /* Modifica l'indicatore del tab attivo */
    .tab-button.active::after {
        bottom: -10px;
        height: 2px;
    }

    /* Assicurati che il contenuto non sbordi */
    .tab-content {
        width: 100%;
        overflow-x: hidden;
    }
}

/* Per schermi molto piccoli */
@media (max-width: 360px) {
    .tab-button {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Modifica gli stili della modale admin per mobile */
@media (max-width: 768px) {
    #statsModal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.4);
        z-index: 1000;
        overflow: hidden;
        /* Assicurati che la modale non sbordi */
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .stats-modal-content {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100vw;
        height: 100vh;
        margin: 0;
        padding: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        box-sizing: border-box;
    }

    .stats-tabs {
        flex: 0 0 auto;
        padding: 10px 15px;
        margin: 0;
        background: #fff;
        position: sticky;
        top: 0;
        z-index: 10;
        border-bottom: 1px solid #ddd;
        width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
        /* Previeni lo scroll elastico su iOS */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: none;
    }

    .tab-content {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 15px;
        position: relative;
        height: calc(100vh - 50px);
        width: 100%;
        box-sizing: border-box;
        /* Previeni lo scroll elastico su iOS */
        overscroll-behavior-x: none;
    }

    /* Assicurati che tutti gli elementi interni rispettino i confini */
    .stats-modal-content * {
        max-width: 100vw;
        box-sizing: border-box;
    }
}

/* Per dispositivi molto piccoli */
@media (max-width: 320px) {
    .stats-modal-content {
        padding: 0;
    }

    .stats-tabs {
        padding: 8px;
    }

    .tab-content {
        padding: 8px;
    }
}

@media (max-width: 768px) {
    #statsModal .close {
        position: absolute;
        right: 15px;
        top: 10px;
        font-size: 24px;
        z-index: 11; /* Sopra i tab che hanno z-index 10 */
        padding: 5px;
        line-height: 1;
        height: 24px;
        width: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: white;
        border-radius: 50%;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    /* Aggiusta il padding del primo tab per evitare sovrapposizioni con il pulsante di chiusura */
    .stats-tabs {
        padding-right: 50px;
    }
}

/* Per dispositivi molto piccoli */
@media (max-width: 320px) {
    #statsModal .close {
        right: 8px;
        top: 8px;
    }
}

/* Aggiungi questi stili per la selezione della modalità */
.podcast-mode-selector {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.podcast-mode-selector > label {
    display: block;
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 12px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #f8f9fa;
    position: relative;
}

.radio-label:hover {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.radio-label input[type="radio"] {
    margin: 3px 12px 0 0;
    flex-shrink: 0;
}

.radio-label .radio-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.radio-label span {
    font-weight: 500;
    color: #2c3e50;
}

.radio-label small {
    color: #6c757d;
    font-size: 0.85em;
    display: block;
    line-height: 1.4;
}

/* Stile per l'opzione selezionata */
.radio-label:has(input[type="radio"]:checked) {
    border-color: #4CAF50;
    background-color: #f1f8f1;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.1);
}

.radio-label:has(input[type="radio"]:checked) span {
    color: #2c3e50;
}

.radio-label:has(input[type="radio"]:checked) small {
    color: #4CAF50;
}

/* Stili responsive */
@media (max-width: 768px) {
    .podcast-mode-selector {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .radio-label {
        padding: 12px;
    }

    .radio-label input[type="radio"] {
        margin: 2px 10px 0 0;
    }

    .radio-label small {
        font-size: 0.8em;
    }
}

/* Animazione sottile al cambio di selezione */
.radio-label {
    transform-origin: center;
    transition: all 0.2s ease;
}

.radio-label:active {
    transform: scale(0.98);
}

.share-link-button {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-link-button:hover {
    background-color: #1976D2;
    transform: scale(1.1);
}

.share-link-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}