/* Reset e stili base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    color: #667eea;
    font-size: 1.8rem;
    font-weight: 700;
}

.navbar ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.navbar a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: color 0.3s;
}

.navbar a:hover,
.navbar a.active {
    color: #667eea;
}

/* Container e Card */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 2.5rem;
    margin-bottom: 2rem;
}

.card h2 {
    color: #667eea;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    border-bottom: 3px solid #667eea;
    padding-bottom: 0.5rem;
}

.card h3 {
    color: #764ba2;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

/* Alert boxes */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.alert a {
    color: inherit;
    font-weight: bold;
    text-decoration: underline;
}

/* Form styles */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: #888;
    font-size: 0.85rem;
}

.form-group small a {
    color: #667eea;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Carte visualizzazione */
.carte-list {
    display: grid;
    gap: 1rem;
    margin: 1.5rem 0;
}

.carta-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    border-left: 5px solid #667eea;
}

.carta-numero {
    background: #667eea;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.carta-nome {
    flex-grow: 1;
    font-weight: 600;
    color: #333;
}

.carta-orientamento {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.carta-orientamento.dritta {
    background: #d4edda;
    color: #155724;
}

.carta-orientamento.rovescia {
    background: #fff3cd;
    color: #856404;
}

/* Interpretazione */
.interpretazione {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid #764ba2;
    line-height: 1.8;
    color: #555;
    font-size: 1.05rem;
}

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

/* 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.7);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover,
.close:focus {
    color: #000;
}

.dettaglio-sezione {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.dettaglio-sezione:last-child {
    border-bottom: none;
}

.dettaglio-sezione h3 {
    color: #764ba2;
    margin-bottom: 1rem;
}

.dettaglio-sezione p {
    margin-bottom: 0.5rem;
    color: #555;
}

/* DataTables custom styling */
.dataTables_wrapper {
    margin-top: 1rem;
}

table.dataTable {
    border-collapse: collapse;
    width: 100%;
}

table.dataTable thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

table.dataTable tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e0e0e0;
}

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

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: white;
    margin-top: 3rem;
}

footer p {
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar ul {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .card {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
    }
}
