/* The dashboard pages' own pieces, on top of app.css: page headers with
   buttons, filter bars, table actions and badges, the form cards, bars. */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-title {
    margin: 0 0 0.75rem;
    color: #1d3c4b;
    font-size: 1.1rem;
    font-weight: 800;
}

.muted { color: #64748b; }

/* Filter bar above a table */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
}

.filter-bar input,
.filter-bar select {
    min-height: 38px;
    padding: 0.4rem 0.75rem;
    border: 1px solid #c8d7e4;
    border-radius: 999px;
    background: #f8fbfd;
    color: #0f172a;
    font-size: 0.88rem;
}

.filter-bar input[type="search"] {
    flex: 1 1 14rem;
    max-width: 22rem;
}

.filter-bar .button {
    border: 0;
}

.filter-clear {
    color: #31657f;
    font-size: 0.85rem;
    font-weight: 700;
}

.filter-count {
    margin-left: auto;
    color: #6b8192;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Tables */

.data-table th,
.data-table td { vertical-align: middle; }

.data-table .num {
    text-align: right;
    white-space: nowrap;
}

.data-table .name a {
    color: #1d3c4b;
    font-weight: 700;
    text-decoration: none;
}

.data-table .name a:hover { text-decoration: underline; }

.sub {
    display: block;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.contact-lines {
    display: grid;
    gap: 0.1rem;
    font-size: 0.85rem;
}

.contact-lines a {
    color: #31657f;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.contact-lines a:hover { text-decoration: underline; }

.contact-lines i { color: #94a3b8; margin-right: 0.2rem; }

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
}

.row-actions form { margin: 0; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid #d5dee6;
    border-radius: 8px;
    background: #fff;
    color: #334e5f;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
}

.icon-btn:hover { background: #eef6fa; }

.icon-btn-danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.icon-btn-danger:hover { background: #fee2e2; }

.icon-btn-good {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-yes { background: #dcfce7; color: #166534; }
.badge-no { background: #fef3c7; color: #92400e; }
.badge-off { background: #eef2f6; color: #64748b; }

.stat-good { color: #166534 !important; }
.stat-warn { color: #b45309 !important; }

/* Cards on the overview */

.cards-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-pad { padding: 1.25rem; }

.card-pad h5 {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 0.9rem;
    color: #1d3c4b;
    font-size: 0.95rem;
    font-weight: 800;
}

.card-list {
    display: grid;
    gap: 0.7rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.card-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid #eef2f6;
    font-size: 0.88rem;
}

.card-list li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.card-list a {
    color: #1d3c4b;
    font-weight: 700;
    text-decoration: none;
}

.card-list a:hover { text-decoration: underline; }

.card-more {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 1rem;
    color: #31657f;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.card-more:hover { text-decoration: underline; }

.empty-note {
    margin: 0;
    color: #64748b;
    font-size: 0.88rem;
}

/* Players by grade: a bar each */

.bars {
    display: grid;
    gap: 0.6rem;
}

.bar-row {
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr) 2.5rem;
    align-items: center;
    gap: 0.75rem;
    color: #334155;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
}

.bar-row:hover { color: #1d3c4b; }

.bar-track {
    height: 12px;
    border-radius: 999px;
    background: #eef2f6;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #4fa3bf 0%, #31657f 100%);
}

.bar-row span:last-child { text-align: right; }

.progress-line {
    height: 10px;
    margin-top: 0.6rem;
    border-radius: 999px;
    background: #fef3c7;
    overflow: hidden;
}

.progress-line div {
    height: 100%;
    background: #22a06b;
}

/* Edit pages (form_page.html) */

.form-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
    color: #31657f;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.form-card {
    display: grid;
    gap: 1rem;
    max-width: 40rem;
    padding: 1.5rem;
}

.form-card form.form-fields {
    display: grid;
    gap: 1rem;
    margin: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.form-card label {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 700;
}

.form-card label.form-check-label-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-card input:not([type="checkbox"]):not([type="file"]),
.form-card select,
.form-card textarea {
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #c8d7e4;
    border-radius: 10px;
    background: #f8fbfd;
    color: #0f172a;
    font-size: 0.92rem;
}

.form-card input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
}

.form-card fieldset {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 1rem;
    border: 1px solid #e5edf3;
    border-radius: 12px;
}

.form-card legend {
    float: none;
    width: auto;
    margin: 0;
    padding: 0 0.4rem;
    color: #1d3c4b;
    font-size: 0.9rem;
    font-weight: 800;
}

.form-required { color: #b45309; }

.form-help {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 500;
}

.form-error {
    color: #991b1b;
    font-size: 0.8rem;
    font-weight: 600;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.form-actions .button { border: 0; }

.form-actions form { margin: 0 0 0 auto; }

.form-actions .form-delete {
    background: #fee2e2;
    color: #991b1b;
}

.form-photo-preview {
    max-width: 100%;
    max-height: 220px;
    border-radius: 12px;
    object-fit: cover;
}

/* Photos page */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.photo-tile {
    overflow: hidden;
    padding: 0;
}

.photo-tile img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.photo-tile-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    font-size: 0.85rem;
}

.photo-tile-body strong {
    display: block;
    color: #1d3c4b;
    overflow-wrap: anywhere;
}

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

@media (max-width: 520px) {
    .form-row { grid-template-columns: 1fr; }
}
