/* =========================================
   ZA RUGBY STATS - MODERN MAIN PAGE
   ========================================= */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    overflow-y: scroll;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;

	/* Rugby stadium background - fixed position */
	background-image: url("../images/RugbyPitch2.jpg");
	background-repeat: no-repeat;
	background-position: center center;
	background-attachment: fixed;
	background-size: cover;
}

/* =========================================
   TOP NAVIGATION BAR
   ========================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #101712, #172c20);
    border-bottom: 3px solid #d4af37;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.45);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.topbar .welcome-header {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 10px;
    text-align: center;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.topbar .welcome-header h1 {
    margin: 0 0 6px;
    font-size: clamp(17px, 1.6vw, 25px);
}

.topbar .welcome-header p {
    margin: 0;
    font-size: 13px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 40px; /* Space between logo and text */
    flex-shrink: 0;
    color: #ffffff;
    text-decoration: none;
}

.brand img {
    width: 105px;
    height: 105px;
    object-fit: contain;
    background: #ffffff;
    padding: 4px;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
    transition: transform 0.3s ease;
}

.brand:hover img {
    transform: scale(1.06);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.brand-text strong {
    color: #ffffff;
    font-size: 21px;
    letter-spacing: 1.5px;
}

.brand-text small {
    color: #c5d5c9;
    font-size: 13px;
}

/* Navigation links */

.nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 5px;
}

.nav-links a {
    color: #f1f1f1;
    text-decoration: none;
    padding: 12px 13px;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.25s ease,
                color 0.25s ease,
                transform 0.25s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background: #285b3b;
    color: #ffffff;
    transform: translateY(-2px);
}

.nav-links .logout-link {
    color: #ff7777;
}

.nav-links .logout-link:hover {
    background: #7b2020;
    color: #ffffff;
}

.logged-in {
    color: #d5dfd7;
    font-size: 12px;
    padding: 8px;
}

.menu-toggle {
    display: none;
    color: #ffffff;
    background: #285b3b;
    border: 1px solid #527a5e;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 22px;
    cursor: pointer;
}

/* =========================================
   WELCOME HEADER
   ========================================= */

.welcome-header {
    max-width: 1200px;
    margin: 28px auto 18px;
    padding: 22px 20px;
    text-align: center;

    background: rgba(8, 20, 12, 0.76);
    border-top: 2px solid rgba(212, 175, 55, 0.8);
    border-bottom: 2px solid rgba(212, 175, 55, 0.8);
    border-radius: 10px;

    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.25);
}

.welcome-header h1 {
    margin: 0 0 12px;
    color: #ffffff;
    font-size: clamp(25px, 3vw, 38px);
    font-weight: 700;
    text-shadow: 2px 2px 5px #000000;
}

.welcome-header p {
    margin: 0;
    color: #f2d778;
    font-size: 17px;
}

/* =========================================
   TEAM IMAGES
   Preserve the original two-row layout
   ========================================= */

.team-section {
    max-width: 1450px;
    margin: 25px auto 35px;
    padding: 0 20px;
}

.team-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-bottom: 28px;
}

.team-row-second {
    margin-top: 8px;
}

.team-card {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 150px;
    height: 150px;
    flex: 0 0 150px;

    padding: 5px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    border: 2px solid rgba(212, 175, 55, 0.8);

    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.35);

    /* Smooth movement only when hovered */
    transition: transform 0.3s ease,
                box-shadow 0.3s ease,
                border-color 0.3s ease;
}

/* Stagger the gentle bouncing animation */

.team-card:nth-child(2) {
    animation-delay: 0.2s;
}

.team-card:nth-child(3) {
    animation-delay: 0.4s;
}

.team-card:nth-child(4) {
    animation-delay: 0.6s;
}

.team-card:nth-child(5) {
    animation-delay: 0.8s;
}

.team-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 9px;
    display: block;
}

/* Bounce higher when hovering */

.team-card:hover {
    transform: translateY(-10px) scale(1.05);
    border-color: #ffe16b;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.55);
    z-index: 2;
}

@keyframes teamFloat {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* =========================================
   PLAYER AND TEAM STATISTICS
   ========================================= */

.stats-section {
    max-width: 1450px;
    margin: 30px auto;
    padding: 22px 20px;

    background: rgba(8, 20, 12, 0.83);
    border: 1px solid rgba(212, 175, 55, 0.65);
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.3);
}

.section-title {
    margin: 0 0 22px;
    text-align: center;
    color: #f2d778;
    font-size: 24px;
    text-shadow: 1px 1px 3px #000000;
}

.stats-row .stats-button {
    margin-right: 10px;
    margin-bottom: 10px;
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 14px;
}

.stats-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    min-height: 50px;
    padding: 13px 20px;

    background: linear-gradient(135deg, #248447, #176333);
    border: 1px solid #5aa873;
    border-radius: 7px;

    color: #ffffff;
    text-align: center;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;

    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);

    transition: transform 0.25s ease,
                background 0.25s ease,
                box-shadow 0.25s ease;
}

.stats-button.disabled {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.stats-button:hover {
    color: #ffffff;
    text-decoration: none;
    background: linear-gradient(135deg, #329d57, #20783e);
    transform: translateY(-4px);
    box-shadow: 0 7px 15px rgba(0, 0, 0, 0.4);
}

.btn-load.disabled {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}


/* Name and surname search fields */
.stats-filter-fields {
    display: flex;
    gap: 20px;
    width: 100%;
    align-items: flex-start;
}

.stats-filter-fields .stats-filter-group {
    flex: 1;
    min-width: 0;
}

.stats-filter-fields .stats-filter-group label {
    display: block;
    color: #ffd700;
    font-weight: 600;
    margin-bottom: 8px;
}

.stats-filter-fields .form-control {
    width: 100%;
    height: 46px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.96);
    color: #183322;
    border: 2px solid #c5a43b;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stats-filter-fields .form-control:focus {
    border-color: #ffd700;
    outline: none;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.45);
}

/* Stack fields on small screens */
@media (max-width: 600px) {
    .stats-filter-fields {
        flex-direction: column;
        gap: 14px;
    }

    .stats-filter-fields .stats-filter-group {
        width: 100%;
    }
}

/* =========================================
   BOTTOM LOGOUT BUTTON
   ========================================= */

.bottom-logout {
    text-align: center;
    padding: 5px 20px 35px;
}

.logout-button {
    padding: 12px 28px;
    color: #ffffff;
    background: #b82c35;
    border: 1px solid #e45a60;
    border-radius: 7px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.25s ease,
                transform 0.25s ease;
}

.logout-button:hover {
    background: #d13b45;
    transform: translateY(-2px);
}

/* =========================================
   TABLETS
   ========================================= */

@media (max-width: 1100px) {
    .topbar-inner {
        gap: 12px;
        padding-left: 18px;
        padding-right: 18px;
    }

    .brand img {
        width: 85px;
        height: 85px;
    }

    .brand-text strong {
        font-size: 17px;
    }

    .nav-links a {
        padding: 10px 9px;
        font-size: 13px;
    }

    .logged-in {
        font-size: 11px;
    }

    .team-row {
        gap: 20px;
    }
}

/* =========================================
   MOBILE NAVIGATION
   ========================================= */

@media (max-width: 760px) {
    .topbar-inner {
        min-height: 85px;
        flex-wrap: wrap;
        padding: 8px 14px;
    }

    .brand {
        gap: 12px;
    }

    .brand img {
        width: 70px;
        height: 70px;
    }

    .brand-text strong {
        font-size: 15px;
        letter-spacing: 1px;
    }

    .brand-text small {
        font-size: 11px;
    }

    .menu-toggle {
        display: block;
        margin-left: auto;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding: 8px 0 12px;
    }

    .nav-links.show {
        display: flex;
    }

    .nav-links a {
        display: block;
        padding: 12px;
        text-align: center;
    }

    .logged-in {
        text-align: center;
        padding: 12px;
    }

    .welcome-header {
        margin: 20px 12px;
        padding: 20px 12px;
    }

    .welcome-header h1 {
        font-size: 25px;
    }

    .welcome-header p {
        font-size: 15px;
    }

    .team-section {
        padding: 0 12px;
    }

    .team-row {
        gap: 18px;
        margin-bottom: 22px;
    }

    .team-card {
        width: 155px;
        height: 155px;
        flex-basis: 155px;
    }

    .stats-section {
        margin: 22px 12px;
        padding: 20px 12px;
    }

    .stats-row {
        gap: 12px;
    }

    .stats-button {
        flex: 1 1 200px;
        min-width: 0;
    }
}

/* =========================================
   SMALL PHONES
   ========================================= */

@media (max-width: 380px) {
    .brand img {
        width: 58px;
        height: 58px;
    }

    .brand-text strong {
        font-size: 13px;
    }

    .brand-text small {
        font-size: 10px;
    }

    .team-card {
        width: 135px;
        height: 135px;
        flex-basis: 135px;
    }

    .stats-button {
        flex-basis: 100%;
    }
}

/* Respect users who prefer reduced motion */

@media (prefers-reduced-motion: reduce) {
    .team-card {
        animation: none;
        transition: none;
    }

    .team-card:hover,
    .stats-button:hover {
        transform: none;
    }
}

/* Rugby Annuals Viewer */
.annuals-viewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 20px 10px;
    box-sizing: border-box;
}

.annuals-images {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 15px;
    width: 100%;
}

.annuals-page {
    display: block;
    width: auto;
    max-width: calc(50% - 10px);
    height: auto;
    max-height: 600px;
    object-fit: contain;
}

.annuals-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

/* Mobile screens */
@media (max-width: 768px) {
    .annuals-images {
        flex-direction: column;
        align-items: center;
    }

    .annuals-page {
        max-width: 100%;
        max-height: none;
    }
}


/* Rugby Annual page selector */
.annuals-page-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    margin: 15px auto 25px;
    padding: 0 10px;
    box-sizing: border-box;
}

.annuals-page-selector label {
    color: #ffd700;
    font-weight: 600;
    margin: 0;
}

.annuals-page-selector select {
    width: auto;
    min-width: 160px;
    max-width: 100%;
    margin: 0;
}

.annuals-page-selector .stats-button {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .annuals-page-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .annuals-page-selector label {
        text-align: center;
    }

    .annuals-page-selector select,
    .annuals-page-selector .stats-button {
        width: 100%;
    }
}