/* Partite Page Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    background-color: rgb(160, 0, 0);
    min-height: 100vh;
    padding: 20px;
}

.partite-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.partite-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.partite-header h1 {
    color: #333;
    font-size: 2.5em;
    flex: 1;
    min-width: 200px;
}

.partite-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-home {
    background-color: rgb(160, 0, 0);
    color: white;
}

.btn-home:hover {
    background-color: rgb(100, 0, 0);
    transform: translateY(-2px);
}

.btn-add {
    background-color: #4CAF50;
    color: white;
}

.btn-add:hover {
    background-color: #388E3C;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.categoria-section {
    margin-bottom: 50px;
}

.categoria-title {
    color: #333;
    font-size: 1.8em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid rgb(160, 0, 0);
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.partita-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 5px solid #667eea;
}

.partita-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.card-info {
    margin-bottom: 15px;
}

.card-info h3 {
    color: #333;
    font-size: 1.3em;
    margin-bottom: 10px;
}

.vs {
    color: #764ba2;
    font-weight: bold;
    margin: 0 8px;
}

.card-info p {
    color: #555;
    margin: 8px 0;
    font-size: 0.95em;
}

.data, .luogo {
    color: #666;
}

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

.btn-edit {
    background-color: #FF9800;
    color: white;
    padding: 10px 15px;
    font-size: 0.9em;
    flex: 1;
    min-width: 120px;
}

.btn-edit:hover {
    background-color: #F57C00;
    transform: translateY(-2px);
}

.btn-delete {
    background-color: #f44336;
    color: white;
    padding: 10px 15px;
    font-size: 0.9em;
    flex: 1;
    min-width: 120px;
}

.btn-delete:hover {
    background-color: #d32f2f;
    transform: translateY(-2px);
}

.no-partite {
    text-align: center;
    padding: 60px 20px;
    background-color: #f5f5f5;
    border-radius: 12px;
}

.no-partite p {
    color: #666;
    font-size: 1.1em;
}

.no-partite a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: bold;
}

.no-partite a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .partite-container {
        padding: 20px;
    }

    .partite-header {
        flex-direction: column;
        align-items: stretch;
    }

    .partite-header h1 {
        font-size: 1.8em;
    }

    .partite-buttons {
        width: 100%;
    }

    .btn {
        flex: 1;
        text-align: center;
    }

    .cards-container {
        grid-template-columns: 1fr;
    }

    .card-actions {
        flex-direction: column;
    }

    .btn-edit, .btn-delete {
        width: 100%;
    }
}

/* SEZIONE SQUADRE */
.squadre-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid #ddd;
}

.squadre-title {
    color: rgb(160, 0, 0);
    font-size: 2em;
    margin-bottom: 30px;
    text-align: center;
}

.categoria-squadre {
    margin-bottom: 40px;
}

.categoria-subtitle {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 20px;
    padding-left: 10px;
    border-left: 4px solid rgb(160, 0, 0);
}

.squadre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.squadra-card {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.3s ease;
}

.squadra-card:hover {
    box-shadow: 0 4px 12px rgba(160, 0, 0, 0.2);
}

.squadra-info {
    flex: 1;
}

.squadra-nome {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 0;
}

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

.no-squadre {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1em;
}

.no-squadre a {
    color: rgb(160, 0, 0);
    text-decoration: none;
    font-weight: bold;
}

@media (max-width: 768px) {
    .squadre-grid {
        grid-template-columns: 1fr;
    }

    .squadra-card {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .squadra-actions {
        margin-top: 15px;
        justify-content: center;
    }

    .squadra-actions .btn {
        flex: 1;
    }
}

/* Calendario specific styling */
.calendario-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #eee;
    width: 100%;
}

.calendario-row + .calendario-row {
    margin-top: 12px;
}

/* Container that forces one event per row */
.calendario-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team {
    flex: 0 0 72px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.team-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    display: block;
}

.team-name {
    flex: 1 1 auto;
    min-width: 0; /* allow truncation */
    font-weight: 700;
    color: #333;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Left team name aligns left, right team name aligns right */
.calendario-row > .team-name:first-of-type {
    text-align: left;
}
.calendario-row > .team-name:nth-of-type(2) {
    text-align: right;
}

.vs {
    flex: 0 0 64px;
    text-align: center;
    font-weight: 800;
    color: #764ba2;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 8px;
}

.meta {
    flex: 0 0 260px;
    text-align: right;
    font-size: 0.95em;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive: reduce meta width on medium screens */
@media (max-width: 1200px) {
    .calendario-row {
        padding: 12px;
    }
    .team-name {
        font-size: 0.95em;
    }
}

/* Tablet landscape */
@media (max-width: 1024px) {
    .partite-header h1 {
        font-size: 2em;
    }
    .categoria-title {
        font-size: 1.6em;
    }
    .meta { 
        flex: 0 0 200px;
        font-size: 0.9em;
    }
}

/* Tablet portrait */
@media (max-width: 900px) {
    .meta { flex: 0 0 180px; }
    .team { flex: 0 0 56px; }
    .team-logo { width: 48px; height: 48px; }
    .vs {
        flex: 0 0 48px;
        font-size: 0.9em;
    }
    .team-name {
        font-size: 0.9em;
    }
}

/* Mobile landscape */
@media (max-width: 768px) {
    .partite-container {
        padding: 20px 15px;
    }
    .calendario-row {
        padding: 10px;
        gap: 8px;
    }
    .team-name {
        font-size: 0.85em;
    }
    .meta {
        flex: 0 0 150px;
        font-size: 0.85em;
    }
}

/* Small screens: stack vertically for readability */
@media (max-width: 600px) {
    .partite-container {
        padding: 15px 10px;
    }
    .partite-header h1 {
        font-size: 1.6em;
    }
    .categoria-title {
        font-size: 1.4em;
    }
    .calendario-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px 10px;
        gap: 10px;
    }
    .team {
        flex: none;
        margin: 5px 0;
    }
    .team-logo {
        width: 56px;
        height: 56px;
    }
    .team-name {
        white-space: normal;
        text-align: center;
        font-size: 1em;
        font-weight: 700;
    }
    .calendario-row > .meta {
        text-align: center;
        margin-top: 8px;
        flex: none;
        width: 100%;
    }
    .calendario-row > .vs {
        margin: 8px 0;
        flex: none;
    }
}

@media (max-width: 400px) {
    .partite-header h1 {
        font-size: 1.4em;
    }
    .categoria-title {
        font-size: 1.2em;
    }
    .team-logo {
        width: 48px;
        height: 48px;
    }
    .team-name {
        font-size: 0.9em;
    }
    .meta {
        font-size: 0.8em;
    }
}
