/* ============================================================
   BOCCEAPP - Sistema Gestione Tornei di Bocce
   ============================================================ */

/* === RESET & BASE === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --secondary: #34a853;
    --success: #198b38;
    --accent: #fbbc04;
    --danger: #ea4335;
    --dark: #202124;
    --gray-100: #f8f9fa;
    --gray-200: #e8eaed;
    --gray-300: #dadce0;
    --gray-400: #bdc1c6;
    --gray-500: #9aa0a6;
    --gray-600: #80868b;
    --gray-700: #5f6368;
    --gray-800: #3c4043;
    --gray-900: #202124;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--gray-100);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* === LAYOUT === */
.container {
    max-width: 1366px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-area {
    flex: 1;
    padding: 30px 0;
}

/* === HEADER / NAVBAR === */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.navbar-brand img {
    width: 36px;
}

.navbar-brand.only-logo img {
    height: 40px;
    width: auto; /* Imposta l'altezza automaticamente */
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.navbar-nav a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--gray-700);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.navbar-nav a:hover,
.navbar-nav a.active {
    background: var(--primary-light);
    color: var(--primary);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gray-200);
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--gray-800);
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--secondary);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-warning {
    background: var(--accent);
    color: var(--dark);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* === CARDS === */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2,
.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-100);
}

/* === FORMS === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.form-control.error {
    border-color: var(--danger);
}

.form-text {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6368' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* === ALERTS (posizionati come toast in alto a destra) === */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Toast notifications - fissi in alto a destra */
.alert:not(.alert-inline) {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    max-width: 420px;
    min-width: 280px;
    margin-bottom: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
    border-radius: 10px;
    animation: slideInRight 0.3s ease-out;
    cursor: pointer;
}

.alert:not(.alert-inline) ~ .alert:not(.alert-inline) {
    margin-top: 60px;
}

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.alert-success {
    background: #e6f4ea;
    color: #1e7e34;
    border: 1px solid #b7e1cd;
}

.alert-danger {
    background: #fce8e6;
    color: #c5221f;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fef7e0;
    color: #ea8600;
    border: 1px solid #fdebb3;
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid #c6dafc;
}

/* === TABLE === */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.9rem;
}

th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover td {
    background: var(--gray-100);
}

/* === BADGE === */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: #e6f4ea;
    color: #1e7e34;
}

.badge-warning {
    background: #fef7e0;
    color: #ea8600;
}

.badge-danger {
    background: #fce8e6;
    color: #c5221f;
}

.badge-info {
    background: #e8f0fe;
    color: #1967d2;
}

.badge-dark {
    background: #e8e8e8;
    color: #5f6368;
}

/* === STAT CARDS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon.green {
    background: #e6f4ea;
    color: var(--secondary);
}

.stat-icon.yellow {
    background: #fef7e0;
    color: #ea8600;
}

.stat-icon.red {
    background: #fce8e6;
    color: var(--danger);
}

.stat-icon.purple {
    background: #f3e8fd;
    color: #7c3aed;
}

.stat-info h3 {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* === RANKING / CLASSIFICA === */
.ranking-list {
    list-style: none;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    transition: var(--transition);
}

.ranking-item:hover {
    background: var(--gray-100);
}

.ranking-position {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ranking-position.top1 {
    background: #fef7e0;
    color: #ea8600;
}

.ranking-position.top2 {
    background: var(--gray-200);
    color: var(--gray-700);
}

.ranking-position.top3 {
    background: #fce8e6;
    color: var(--danger);
}

.ranking-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.ranking-info {
    flex: 1;
}

.ranking-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.ranking-detail {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.ranking-rating {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.ranking-change {
    font-size: 0.8rem;
    font-weight: 600;
}

.ranking-change.up {
    color: var(--secondary);
}

.ranking-change.down {
    color: var(--danger);
}

/* === STANDINGS TABLE (classifica torneo) === */
.standings-table th:nth-child(1) {
    width: 50px;
    text-align: center;
}

.standings-table td:nth-child(1) {
    text-align: center;
    font-weight: 700;
    padding-inline: 5px;
}

.standings-table tr.expanded {
background: var(--gray-100)!important;
}


.standings-table .pos-1 {
    background: #f8fff6 !important;
}

.standings-table .pos-2 {
    background: #fff !important;
}

.standings-table .pos-3 {
    background: #b7fea6 !important;
}

.standings-table .pos-cutoff {
    background: #fff3f2 !important;
    border-bottom: 2px solid var(--danger) !important;
}

/* === TOURNAMENT BRACKET === */
.bracket {
    display: flex;
    gap: 40px;
    overflow-x: auto;
    padding: 20px 0;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 200px;
}

.bracket-round-title {
    text-align: center;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-200);
}

.bracket-match {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    min-width: 180px;
    transition: var(--transition);
    cursor: pointer;
}

.bracket-match:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.bracket-match.winner {
    border-color: var(--secondary);
    background: #e6f4ea;
}

.bracket-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.9rem;
}

.bracket-team.winner {
    font-weight: 700;
}

.bracket-score {
    font-weight: 700;
    color: var(--gray-800);
}

/* === MATCH LIST === */
.match-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    padding: 16px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.match-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary);
}

.match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.match-team {
    flex: 1;
    text-align: center;
    font-weight: 500;
}

.match-team.winner {
    font-weight: 700;
    color: var(--secondary);
}

.match-score-display {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    text-align: center;
    min-width: 60px;
}

.match-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* === PROFILE === */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--gray-200);
}

.profile-info h1 {
    font-size: 1.6rem;
    font-weight: 700;
}

.profile-info .rating {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 600;
}

.profile-level {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* === FOOTER === */
.footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 20px 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: auto;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .navbar-nav {
        display: none;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .bracket {
        gap: 20px;
    }

    .bracket-round {
        min-width: 150px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .card-body {
        padding: 16px;
    }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease;
}

/* === TABS === */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
    gap: 0;
}

.tab {
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-600);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--gray-700);
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* === LOADING === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 0.9rem;
    animation: slideInRight 0.3s ease;
    max-width: 380px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    background: var(--secondary);
    color: white;
}

.toast-error {
    background: var(--danger);
    color: white;
}

.toast-info {
    background: var(--primary);
    color: white;
}

/* === INFO TOOLTIP === */
.info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gray-400);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    position: relative;
    margin-left: 6px;
    flex-shrink: 0;
    transition: var(--transition);
    font-style: italic;
    font-family: serif;
    line-height: 1;
    vertical-align: middle;
    user-select: none;
}

.info-tip:hover {
    background: var(--primary);
}

.info-tip:focus {
    background: var(--primary);
    outline: none;
}

.info-tip .tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: 280px;
    background: var(--dark);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 400;
    font-style: normal;
    font-family: var(--font);
    text-align: left;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    position: absolute;
    z-index: 1000;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    box-shadow: var(--shadow-lg);
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    line-height: 1.5;
    white-space: normal;
}

.info-tip .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--dark) transparent transparent transparent;
}

.info-tip:hover .tooltip-text,
.info-tip:focus .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* === BONUS ROWS DYNAMIC === */
.bonus-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 10px;
    padding: 14px;
    background: var(--white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.bonus-row:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.bonus-row .form-group {
    margin-bottom: 0;
}

.btn-remove-bonus {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--danger);
    background: transparent;
    color: var(--danger);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-bottom: 0;
    align-self: center;
}

.btn-remove-bonus:hover {
    background: var(--danger);
    color: var(--white);
    transform: scale(1.1);
}

.btn-add-bonus {
    padding: 10px 20px;
    border: 2px dashed var(--secondary);
    background: transparent;
    color: var(--secondary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.btn-add-bonus:hover {
    background: #e6f4ea;
    border-style: solid;
}

@keyframes bonusFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bonus-row-new {
    animation: bonusFadeIn 0.25s ease;
}



.groups-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.groups-cards-container .card{
    flex: 1 1 40%;
}

/* === RATING CHANGE LINK (clickable rating in match cards) === */
.rating-change-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    padding: 3px 10px;
    border-radius: 12px;
    transition: var(--transition);
    text-decoration: none;
    user-select: none;
}

.rating-change-link.up {
    color: var(--secondary);
    background: #e6f4ea;
}

.rating-change-link.down {
    color: var(--danger);
    background: #fce8e6;
}

.rating-change-link:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.rating-change-link.up:hover {
    background: #d4edda;
}

.rating-change-link.down:hover {
    background: #f5c6cb;
}

.rating-change-icon {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* === RATING DETAIL MODAL (wide) === */
.modal-rating-wide {
    max-width: 680px;
}

/* Formula components */
.formula-component {
    background: var(--gray-100);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.formula-component:hover {
    background: var(--primary-light);
}

.formula-component-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.formula-var {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.formula-val {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary);
}

.formula-component-desc {
    font-size: 0.83rem;
    color: var(--gray-600);
    line-height: 1.5;
}

/* Loading spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--gray-500);
    font-size: 0.9rem;
}

.spinner-mini {
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Ranking detail rows hover */
.ranking-detail-row:hover {
    background: var(--primary-light) !important;
}

.info-badge-small {
    font-size: 0.75rem;
    opacity: 0.6;
    transition: var(--transition);
    cursor: pointer;
}

.ranking-detail-row:hover .info-badge-small {
    opacity: 1;
    color: var(--primary);
}

/* Level bars in modal */
.level-bar {
    transition: var(--transition);
}

.level-bar:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

/* Modal close button */
.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close-btn:hover {
    background: var(--gray-200);
    color: var(--dark);
}

/* Rating timeline */
.rating-timeline {
    transition: var(--transition);
}

.rating-timeline:hover {
    box-shadow: var(--shadow-sm);
}

/* Winrate bar */
.winrate-bar-container {
    padding: 4px 0;
}


.team-name-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.team-name-dash {
    font-weight: 600;
    color: var(--gray-400);
    font-size: 1.1rem;
    margin: 0 2px;
}

.team-name-container-inner {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.15;
}

.team-name {
    font-weight: 700;
    font-size: 0.85rem;
}

.team-surname {
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--gray-500);
}



.player-latestmatch-container{
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

/* === GROUP MATCH ITEM (shared: admin + frontend) === */
.group-matches-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 1rem;
}

.group-match-search {
    width: 100%;
    margin-bottom: 16px;
}

.group-match-item {
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    width: 100%;
    position: relative;
    align-items: center;
    text-decoration: none;
    color: inherit;
}


.admin-layout .group-match-item{
    cursor: pointer;
}

.group-match-item .badge {
    width: 200px;
    text-align: center;
    flex-shrink: 0;
}

.group-match-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.group-match-teams {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 100%;
}

.group-match-team {
    font-weight: 500;
    line-height: 1.4;
    display: flex;
    justify-content: center;
    width: 240px;
    text-align: center;
    flex-wrap: wrap;
}

.group-match-team.winner {
    font-weight: 700;
    color: var(--secondary);
}

.group-match-score {
    text-align: center;
    width: 120px;
    flex: 0 0 auto;
}

.group-match-score-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.group-match-score-value .vs-text {
    color: var(--gray-400);
    font-weight: 400;
}

.group-match-fase {
    font-size: 0.75rem;
    color: var(--gray-500);
    min-width: 170px;
    flex-shrink: 0;
}

@media (max-width: 1279px) {
    .group-match-fase {
        min-width: auto;
    }
}

.group-match-fase .badge {
    font-size: 0.75rem;
    width: auto;
}

.group-match-origin {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-weight: 400;
}

@media (max-width: 979px) {
    .group-match-teams {
        flex-wrap: wrap;
        gap: 0 1rem;
    }

    .team-name-container{
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem;
    }

    .team-name-dash{
        display: none;
    }

    .group-match-item {
        flex-direction: column;
        align-items: stretch;
    }

    .group-match-item .badge {
        width: 100%;
        margin-top: 8px;
    }

    .group-match-team {
        width: auto;
    }

    .group-match-fase {
        min-width: 0;
        margin-bottom: 8px;
        text-align: center;
    }

    .group-match-score {
        width: 100%;
        padding: 8px 0;
        order: 1;
    }

}