* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 300;
    letter-spacing: 1px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    padding: 3rem 0;
}

.course-selector {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-bottom: 2rem;
}

.course-selector h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 400;
}

.course-dropdown {
    width: 100%;
    max-width: 500px;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.course-dropdown:hover {
    border-color: #3498db;
}

.course-dropdown:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.course-details {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    animation: fadeIn 0.5s ease-in-out;
}

.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#courseName {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 400;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.info-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: transform 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
    color: #6c757d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.info-card p {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
}

.chart-container {
    margin: 3rem 0;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    position: relative;
    height: 400px;
}

.ratings-detail {
    margin-top: 3rem;
}

.ratings-detail h3 {
    color: #2c3e50;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 400;
}

.rating-bars {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.rating-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rating-label {
    color: #6c757d;
    font-weight: 500;
    font-size: 0.95rem;
}

.rating-bar-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rating-bar {
    height: 30px;
    background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
    border-radius: 15px;
    transition: width 1s ease-out;
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.3);
    min-width: 0;
    flex: 1;
}

.rating-value {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 50px;
    text-align: right;
}

footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

footer p {
    opacity: 0.8;
}

/* Export PDF Button */
.export-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.export-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.export-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Stili per il header del corso con pulsante modifica */
.course-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.course-actions {
    display: flex;
    gap: 1rem;
}

.edit-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.edit-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* Stili per il modal */
.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.5);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-weight: 400;
    font-size: 1.5rem;
}

.close-modal {
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.close-modal:hover {
    transform: rotate(90deg);
}

/* Stili per il form */
.edit-form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.form-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.form-section h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 400;
}

.ratings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.rating-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rating-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #e0e6ed;
    outline: none;
    -webkit-appearance: none;
}

.rating-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rating-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
}

.rating-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.rating-display {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e6ed;
}

.btn-cancel,
.btn-save {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-cancel {
    background: #e0e6ed;
    color: #6c757d;
}

.btn-cancel:hover {
    background: #d1d8e0;
}

.btn-save {
    background: #2ecc71;
    color: white;
}

.btn-save:hover {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-container {
        height: 300px;
        padding: 1rem;
    }
    
    .course-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .ratings-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
    }
}

/* Stili per il menu di navigazione */
.main-nav {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.main-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.main-nav li {
    margin: 0 1rem;
}

.main-nav a {
    display: block;
    padding: 1rem 2rem;
    color: #6c757d;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.main-nav a:hover {
    color: #3498db;
    background: #f8f9fa;
}

.main-nav a.active {
    color: #2c3e50;
    border-bottom-color: #3498db;
}

/* Stili per la pagina classifica */
.ranking-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.ranking-header {
    text-align: center;
    margin-bottom: 3rem;
}

.ranking-header h2 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.ranking-header p {
    color: #6c757d;
    font-size: 1.1rem;
}

.ranking-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    color: #6c757d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-card p {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* Stili per la tabella classifica */
.ranking-table-container {
    overflow-x: auto;
    margin-bottom: 3rem;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.ranking-table thead {
    background: #f8f9fa;
}

.ranking-table th {
    padding: 1rem;
    text-align: left;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
}

.ranking-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.3s ease;
}

.ranking-table tbody tr:hover {
    background-color: #f8f9fa;
}

.ranking-table td {
    padding: 1rem;
    color: #495057;
}

.position-cell {
    font-weight: 600;
    text-align: center;
}

.medal {
    font-size: 1.5rem;
}

.position-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1) 0%, transparent 100%);
}

.position-2 {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.1) 0%, transparent 100%);
}

.position-3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.1) 0%, transparent 100%);
}

.course-name {
    font-weight: 500;
    color: #2c3e50;
}

.total-score {
    font-weight: 600;
    color: #3498db;
    font-size: 1.1rem;
}

.score-badge {
    display: inline-block;
    background: linear-gradient(135deg, #3498db 0%, #2ecc71 100%);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.chart-section {
    margin-top: 3rem;
}

.chart-section h3 {
    color: #2c3e50;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 400;
    text-align: center;
}

.ranking-chart {
    height: 500px;
}

@media (max-width: 768px) {
    .main-nav ul {
        flex-direction: column;
        text-align: center;
    }
    
    .main-nav li {
        margin: 0;
    }
    
    .ranking-header h2 {
        font-size: 2rem;
    }
    
    .ranking-table {
        font-size: 0.85rem;
    }
    
    .ranking-table th,
    .ranking-table td {
        padding: 0.5rem;
    }
    
    .medal {
        font-size: 1.2rem;
    }
    
    .ranking-chart {
        height: 400px;
    }
}

/* Stili per il selettore con pulsante nuovo corso */
.selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.new-course-btn {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.new-course-btn:hover {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

/* Stile per il pulsante elimina */
.delete-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.delete-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Stili per i commenti */
.comments-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-top: 2rem;
}

.comments-section h3 {
    color: #2c3e50;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comment-item {
    background: #f8f9fa;
    padding: 1.2rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    position: relative;
    transition: transform 0.2s ease;
}

.comment-item:hover {
    transform: translateX(5px);
    background: #f0f2f5;
}

.comment-quote {
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 2rem;
    color: #3498db;
    opacity: 0.3;
    font-family: Georgia, serif;
}

.comment-text {
    margin: 0;
    padding-left: 2rem;
    color: #495057;
    font-style: italic;
    line-height: 1.6;
}

.no-comments {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* Stili per input commenti nei form */
.comments-input-section {
    margin-top: 1rem;
}

.comments-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.comment-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.comment-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.comment-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-add-comment {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.btn-add-comment:hover {
    background: #218838;
}

.btn-remove-comment {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.3s ease;
    min-width: 40px;
}

.btn-remove-comment:hover {
    background: #c82333;
}

@media (max-width: 768px) {
    .selector-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .selector-header h2 {
        margin-bottom: 0;
    }

    .course-actions {
        flex-direction: column;
        width: 100%;
    }

    .course-actions button {
        width: 100%;
    }

    .comment-input-group {
        flex-direction: column;
    }

    .btn-remove-comment {
        width: 100%;
    }
}