/* Stile base per l'area admin */
:root {
    --colore-primario-admin: #2c3e50; /* Blu scuro */
    --colore-secondario-admin: #3498db; /* Blu chiaro */
    --colore-sfondo-admin: #ecf0f1;
    --colore-bianco: #ffffff;
    --colore-testo: #333;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: var(--colore-sfondo-admin);
    color: var(--colore-testo);
}

.admin-container {
    display: flex;
    min-height: 100vh;
}

/* ==================
   NAVIGAZIONE LATERALE
================== */
.admin-nav {
    width: 250px;
    background-color: var(--colore-primario-admin);
    color: var(--colore-bianco);
    flex-shrink: 0; /* Impedisce che si rimpicciolisca */
}

.nav-header {
    padding: 20px;
    text-align: center;
    background-color: rgba(0,0,0,0.2);
}
.nav-header h3 {
    margin: 0;
    color: var(--colore-bianco);
}

.admin-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-nav ul li a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #bdc3c7; /* Grigio chiaro */
    transition: background-color 0.3s ease, color 0.3s ease;
}

.admin-nav ul li a i {
    margin-right: 15px; /* Spazio tra icona e testo */
    width: 20px;
    text-align: center;
}

.admin-nav ul li.active a {
    background-color: var(--colore-secondario-admin);
    color: var(--colore-bianco);
}

.admin-nav ul li a:hover {
    background-color: #34495e; /* Un po' più chiaro del fondo */
    color: var(--colore-bianco);
}

/* ==================
   CONTENUTO PRINCIPALE
================== */
.admin-content {
    flex-grow: 1; /* Occupa tutto lo spazio rimanente */
    padding: 30px;
}

.content-header {
    border-bottom: 2px solid #ddd;
    padding-bottom: 20px;
    margin-bottom: 30px;
}
.content-header h1 {
    margin: 0 0 10px 0;
    font-size: 2rem;
}
.content-header p {
    margin: 0;
    font-size: 1.1rem;
    color: #777;
}

.content-body {
    background: var(--colore-bianco);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* Stili Dashboard */
.stat-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.box {
    background: #f9f9f9;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 5px;
    text-align: center;
}
.box h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #555;
}
.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--colore-secondario-admin);
}
.btn-primary {
    background-color: var(--colore-secondario-admin);
    color: var(--colore-bianco);
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    display: inline-block;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.btn-primary:hover {
    background-color: #2980b9;
}


/* Stili Form */
.form-container {
    max-width: 800px;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}
.form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    box-sizing: border-box; /* Importante per il padding */
}
.form-group small {
    display: block;
    margin-top: 5px;
    color: #777;
}

/* Stili per i messaggi di stato */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-size: 1rem;
    border: 1px solid transparent;
}
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Stili per il nuovo form */
.form-section {
    background-color: #fdfdfd;
    border: 1px solid #eee;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 8px;
}
.form-section h2 {
    font-size: 1.3rem;
    color: var(--colore-primario-admin);
    margin: -25px -25px 20px -25px;
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
    border-radius: 8px 8px 0 0;
}
.form-section h2 i {
    margin-right: 10px;
    color: var(--colore-secondario-admin);
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    resize: vertical;
    min-height: 80px;
}
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    background: #fff;
}
.btn-secondary {
    background-color: #7f8c8d;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}
.btn-secondary:hover {
    background-color: #6c7a7b;
}
.btn-secondary i {
    margin-right: 5px;
}
.btn-submit {
    font-size: 1.2rem;
    padding: 15px 30px;
}
.day-block {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ddd;
}
.day-block:last-child {
    border-bottom: none;
}

/* Stili per la Tabella in lista.php */
.table-container {
    width: 100%;
    overflow-x: auto; /* Per schermi piccoli */
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse; /* Bordi uniti */
}

table thead tr {
    border-bottom: 2px solid #ddd;
    background-color: #f9f9f9;
}

table th {
    padding: 15px;
    text-align: left;
    font-size: 0.9rem;
    color: #555;
    text-transform: uppercase;
}

table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}
table tbody tr:last-child {
    border-bottom: none;
}
table tbody tr:hover {
    background-color: #fcfcfc;
}

table td {
    padding: 15px;
    vertical-align: middle;
}
table td strong {
    color: var(--colore-primario-admin);
}

/* Badge per tipo (gratuito/pagamento) */
.badge {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
}
.badge-pagamento {
    background-color: #27ae60; /* Verde */
}
.badge-gratuito {
    background-color: #e67e22; /* Arancione */
}

/* Pulsanti di Azione (Modifica/Elimina/Vedi) */
td.actions {
    text-align: right;
    white-space: nowrap; /* Impedisce ai bottoni di andare a capo */
}
.btn-action {
    display: inline-block;
    padding: 8px 10px;
    border-radius: 5px;
    margin-left: 5px;
    text-decoration: none;
    color: #fff;
    transition: background-color 0.3s ease;
}
.btn-action i {
    font-size: 0.9rem;
}

.btn-view {
    background-color: #3498db; /* Blu */
}
.btn-view:hover {
    background-color: #2980b9;
}

.btn-edit {
    background-color: #f39c12; /* Giallo/Arancio */
}
.btn-edit:hover {
    background-color: #e67e22;
}

.btn-delete {
    background-color: #e74c3c; /* Rosso */
}
.btn-delete:hover {
    background-color: #c0392b;
}

/* Stile per il nuovo pulsante "Magico" */
.btn-magic {
    background-color: #9b59b6; /* Viola */
    font-weight: bold;
    font-size: 0.9rem;
    padding: 10px 15px;
}
.btn-magic:hover {
    background-color: #8e44ad;
}
.btn-magic i {
    margin-right: 5px;
}

/* Stili per l'editor Fase B */
.day-editor-block {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
    background: #fdfdfd;
}
.day-editor-block h3 {
    margin: 0;
    padding: 15px 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    border-radius: 8px 8px 0 0;
}
.day-reference {
    background: #fffbef;
    padding: 15px 20px;
    border-bottom: 1px dashed #ffe8a1;
    font-size: 0.9rem;
}
.day-editor-block textarea {
    border: none;
    border-top: 1px solid #eee;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 15px 20px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 1rem;
    border-radius: 0 0 8px 8px;
}

/* Stili per il Modal Viator */
.modal-overlay {
    display: none; /* Nascosto di default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}
.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}
.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #888;
}
.modal-body {
    padding: 0;
}
.modal-body iframe {
    width: 100%;
    height: 60vh;
    border: none;
}

/* Stili per l'Editor Magico */
#visual-editor-container {
    background: #f4f7f6;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
}
.day-block-editor {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--colore-primario-admin);
    border-radius: 8px 8px 0 0;
}
.day-title-input {
    flex-grow: 1;
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
    background: transparent;
    border: none;
    padding: 5px;
}
.day-title-input::placeholder { color: #bdc3c7; }
.btn-delete-day {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
}
.day-sections-container {
    padding: 15px;
    min-height: 50px;
}
.btn-add-section {
    margin: 0 15px 15px 15px;
    font-size: 0.9rem;
}

/* Stili Sezioni */
.section-block-editor {
    border: 1px dashed #bbb;
    border-radius: 5px;
    margin-bottom: 15px;
    background: #fdfdfd;
}
.section-header {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #f0f0f0;
    align-items: center;
}
.section-type-select { padding: 8px; flex-shrink: 0; }
.section-title-input { flex-grow: 1; padding: 8px; }
.btn-delete-section {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}
.section-content {
    padding: 10px;
}
.section-content textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    font-family: Consolas, monospace;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Blocco Preview Viator */
.viator-preview-box {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f4f7f6;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
}
.viator-preview-content { flex-grow: 1; }
.viator-preview-content strong { font-size: 1rem; }
.viator-preview-content p { font-size: 0.9rem; margin: 5px 0 0 0; color: #333; }
.viator-preview-content img { border-radius: 4px; float: right; }
.btn-viator {
    background: #9b59b6;
    color: white;
    padding: 10px 15px;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.editor-controls-footer {
    display: flex;
    justify-content: space-between;
    padding: 20px 0;
    margin-top: 10px;
    border-top: 1px solid #ccc;
}