/* --- Importar Google Font (Ara al header.php) --- */

/* --- Estils Generals: EL REDISSENY "NOBLE" --- */
:root {
    --green-noble: #004225; /* El nou verd "Masters" */
    --green-bright: #0b6623; /* L'antic, per a accents */
    --bg-cream: #fbfaf5;    /* El nou fons */
    --bg-white: #ffffff;    /* El fons de les targetes */
    --text-color: #333333;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;
}

body {
    font-family: var(--font-body); /* Nova font de cos */
    margin: 0;
    padding: 0;
    background: var(--bg-cream); /* Nou fons crema */
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background: var(--green-noble); /* Nou verd noble */
    color: #fff;
    padding: 20px 25px; /* Una mica més d'espai */
    position: relative; 
    z-index: 10; 
    box-shadow: 0 3px 8px rgba(0,0,0,0.1); 
}

header .title {
    font-family: var(--font-heading); /* Nova font de títol */
    font-size: 26px; /* Més gran */
    font-weight: 700;
}

nav a {
    color: #fff;
    margin-right: 15px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    opacity: 0.9;
    transition: opacity 0.2s;
}
nav a:hover {
    opacity: 1;
    text-decoration: underline;
}
nav a[style*="fff0a8"] {
    opacity: 1;
}

/* Estils per a les icones del menú */
nav a i.fa-solid {
    margin-right: 6px;
    width: 1.1em; /* Alinea les icones */
    text-align: center;
}


main.container {
    max-width: 1000px;
    margin: 30px auto; /* Més marge superior */
    padding: 0 20px;
    position: relative;
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    font-size: 0.9em;
    color: #aaa; /* Més suau */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading); /* Nova font de títol */
    color: var(--green-noble); /* Nou verd noble */
    margin-top: 20px;
}
h2 { font-size: 2.2em; }
h3 { font-size: 1.8em; }
h4 { font-size: 1.4em; }

/* Estil de "Volum" per a Capçaleres de Targetes */
.card h2:first-child, 
.card h3:first-child,
.tab-panel h2:first-child, 
.tab-panel h3:first-child {
    margin-top: 0; 
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0; /* La línia que dona volum */
}


/* --- Components --- */
.card {
    background: var(--bg-white); /* Blanc pur */
    border-radius: 8px;
    padding: 25px 30px; /* Més padding */
    margin-bottom: 25px; /* Més separació */
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0; /* Vora molt subtil */
}

.btn {
    display: inline-block;
    padding: 12px 22px; 
    background: var(--green-noble); 
    color: #fff;
    text-decoration: none;
    border-radius: 6px; 
    font-size: 15px;
    font-weight: bold;
    border: 1px solid var(--green-noble);
    cursor: pointer;
    transition: all 0.2s ease-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.btn:hover {
    background: #002f1a; 
    border-color: #002f1a;
    transform: translateY(-1px); 
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--green-noble);
    border: 1px solid #ddd;
    box-shadow: none;
}

.btn-secondary:hover {
    background: #fdfdfd;
    border-color: #ccc;
    transform: none;
    box-shadow: none;
}

/* --- Formularis --- */
label {
    display: block;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 0.95em;
    font-family: var(--font-body);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box; 
    margin-top: 6px;
    font-size: 16px;
    font-family: var(--font-body); 
    background: #fdfdfd; 
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus {
    border-color: var(--green-noble);
    box-shadow: 0 0 5px rgba(0, 66, 37, 0.2);
    outline: none;
}

input[type="submit"].btn {
    width: auto;
    margin-top: 10px;
}

input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
}
label input[type="checkbox"] {
    width: auto;
    margin-top: 0;
}

/* --- Taules (Admin) --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden; 
}

th, td {
    padding: 14px 18px;
    border-bottom: 1px solid #eee; 
    text-align: left;
    font-family: var(--font-body);
}

th {
    background-color: #f8f8f8;
    color: #333;
    font-weight: bold;
}

tr:nth-child(even) {
    background-color: #fdfdfd;
}

tr:hover {
    background-color: #f5f5f5; 
}

/* --- Landing --- */
.landing {
    min-height: calc(100vh - 140px); 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.landing-logo img {
    max-width: 280px;
    height: auto;
    margin-bottom: 20px;
}

.landing-title {
    font-family: var(--font-heading); 
    font-size: 48px; 
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--green-noble); 
}

.landing-subtitle {
    font-family: var(--font-body); 
    font-size: 18px;
    margin-bottom: 30px;
    color: #555;
    max-width: 450px;
}

.landing-buttons .btn {
    margin: 0 8px 8px 8px;
    font-size: 16px;
}

/* --- Formularis de Login/Registre --- */
.form-container {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.form-link {
    font-size: 0.9em;
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: block;
}

.form-link a {
    color: var(--green-noble);
    text-decoration: none;
    font-weight: bold;
}

.form-link a:hover {
    text-decoration: underline;
}

/* --- Estils per botons petits (Admin i Veure Targeta) --- */
.btn.btn-small,
.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
    margin-top: 10px;
    margin-right: 4px; 
    vertical-align: middle; 
    box-shadow: none; 
}
.btn.btn-small:hover {
    transform: none;
    box-shadow: none;
}
.btn.btn-small {
    margin-top: 0;
}


/* --- Estils per Veure Targeta (view_rounds.php) --- */
.scorecard-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    margin-top: 0;
}

.scorecard-detail.visible {
    max-height: 1000px; 
    margin-top: 20px;
}
.scorecard-detail .scorecard-grid {
    gap: 5px;
}
.scorecard-detail .hole-card {
    padding: 8px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.hole-score-display {
    width: 100%;
    text-align: center;
    font-size: 1.8em;
    font-weight: bold;
    padding: 10px 0;
    line-height: 1;
    color: #333;
}

/* --- Estils per Pestanyes (Stats i Index) --- */
ul.tabs {
    list-style-type: none;
    margin: 20px 0 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--green-noble); 
}
ul.tabs li {
    padding: 12px 20px; 
    margin-bottom: -2px; 
    cursor: pointer;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    margin-right: 5px;
    font-weight: bold;
    color: #555;
    transition: all 0.2s;
    font-family: var(--font-body);
}
ul.tabs li:hover {
    background: #e9e9e9;
}
ul.tabs li.active {
    background: var(--bg-white); 
    border-color: var(--green-noble);
    border-bottom: 2px solid var(--bg-white);
    color: var(--green-noble);
}
ul.tabs li i.fa-solid {
    margin-right: 8px;
    color: #888;
}
ul.tabs li.active i.fa-solid {
    color: var(--green-noble);
}

.tab-panel {
    display: none; 
    background: var(--bg-white); 
    border: 2px solid var(--green-noble);
    border-top: none;
    padding: 25px 30px;
    border-radius: 0 0 8px 8px;
    margin-bottom: 25px;
}
.tab-panel.active {
    display: block; 
}
.tab-panel .card {
    box-shadow: none;
    border: 1px solid #eee;
    padding: 20px;
    margin-bottom: 20px;
}
.tab-panel .card h3:first-child {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}


/* === ESTIL TARGETA (Graella 3x3) === */
.scorecard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 15px; 
    margin-top: 20px;
    position: relative; 
    z-index: 5; 
}

.hole-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.hole-card-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    font-weight: bold;
    color: #777;
    margin-bottom: 8px;
    padding: 0 2px;
}
.hole-card-header .par {
    color: #555;
}
.hole-card-header .hcp {
    color: #888;
}

.hole-number {
    font-size: 2.2em; 
    font-weight: bold;
    color: var(--green-noble); 
    margin: 5px 0 10px 0;
    line-height: 1;
}

.hole-input {
    width: 100%;
    text-align: center;
    font-size: 2em !important; 
    font-weight: bold;
    padding: 10px 0 !important; 
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    -moz-appearance: textfield;
}
.hole-input::-webkit-outer-spin-button,
.hole-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.hole-input:focus {
    background: #f4f8f4; 
    outline: 2px solid var(--green-noble);
}

#total-card {
    margin-top: 20px;
    padding: 20px;
    text-align: center;
    background: var(--green-noble); 
    color: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative; 
    z-index: 5; 
}
#total-card-title {
    font-family: var(--font-body); 
    font-size: 1.1em;
    font-weight: bold;
    margin: 0;
    color: #fff; 
}
#gross-total-display {
    font-size: 2.5em;
    font-weight: bold;
    display: block;
    line-height: 1.2;
}

@media (max-width: 350px) {
    .scorecard-grid {
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
    }
}
/* === FI: ESTIL TARGETA (Graella 3x3) === */


/* === ESTIL MARCA D'AIGUA === */
main.container::before {
    content: "";
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%; 
    height: 100%;
    z-index: -1; 
    background-repeat: no-repeat;
    background-position: center 50px; 
    background-size: contain; 
    opacity: 0.1; 
    pointer-events: none;
    display: none; 
}

body.course-bosc main.container::before {
    display: block;
    background-image: url('/images/mapa_bosc.png');
}
body.course-piscina main.container::before {
    display: block;
    background-image: url('/images/mapa_piscina.png');
}
/* === FI: ESTIL MARCA D'AIGUA === */

/* === ESTIL LLISTA JUGADORS (index.php) === */
.player-list-widget {
    list-style-type: none;
    padding: 0;
    margin-top: 20px;
    max-height: 250px; 
    overflow-y: auto;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 5px;
}
.player-list-widget li {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    font-size: 0.95em;
    display: flex;
    justify-content: space-between;
}
.player-list-widget li:last-child {
    border-bottom: none;
}
.player-list-widget li .hcp {
    font-weight: bold;
    color: #555;
}
/* === FI: ESTIL LLISTA JUGADORS === */

/* === ESTIL ICONES (stats.php) === */
.tab-panel .card h4 i.fa-solid,
.tab-panel .card h5 i.fa-solid {
    margin-right: 10px;
    font-size: 0.9em;
    width: 1.1em; 
    text-align: center;
    color: #888; 
}
.tab-panel .card h4 i.fa-medal { color: #f9a602; }
.tab-panel .card h4 i.fa-hammer { color: #7a5549; }
.tab-panel .card h4 i.fa-sack-dollar { color: #5a8c3d; }
.tab-panel .card h4 i.fa-crown { color: #f9a602; }
.tab-panel .card h4 i.fa-crosshairs { color: #c00; }
.tab-panel .card h4 i.fa-feather-pointed { color: #2a8bc2; }
.tab-panel .card h5 i.fa-table-list { color: #555; }

/* === NOU: ESTIL ICONES (index.php Normes) === */
.tab-panel#tab-normes h3 {
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0; /* La línia que dona volum */
    margin-top: 25px; /* Separació entre normes */
}
.tab-panel#tab-normes h3:first-child {
    margin-top: 0; /* La primera no necessita marge superior */
}
.tab-panel#tab-normes h3 i.fa-solid {
    margin-right: 12px;
    font-size: 0.85em;
    width: 1.1em;
    text-align: center;
    color: var(--green-noble);
    opacity: 0.8;
}
hr.elegant-divider {
    border: 0;
    height: 1px;
    background-color: #f0f0f0;
    margin: 30px 0;
}