/* =============================================================
   COMPONENTS — shared UI elements used on both public & app
   ============================================================= */

/* --- Page wrapper (shared base) --- */
.pageWrapper {
    float: left;
    width: 100%;
    min-height: 100%;
    margin-bottom: -1.5em;
    padding-bottom: 2.5em;
    padding-left: 1em;
    padding-right: 1em;
    clear: both;
    background-color: var(--color-slate-100, #f1f5f9);
}

/* --- Buttons --- */
.btn, .btn:visited {
    display: inline-block;
    padding: 0.5em 1em;
    background-color: #007bff;
    color: white !important;
    text-decoration: none;
    border-radius: var(--radius-sm);
    text-align: center;
    border: none;
    cursor: pointer;
    font-size: 1em;
}

.btn:hover, .btn:visited:hover {
    background-color: #0056b3;
}

.btn.btn-primary   { background-color: #007bff; }
.btn.btn-secondary { background-color: #6c757d; }
.btn.btn-danger    { background-color: #dc3545; }

.btn.btn-primary:hover   { background-color: #0056b3; }
.btn.btn-secondary:hover { background-color: #545b62; }
.btn.btn-danger:hover    { background-color: #a71d2a; }

.btn-sm, .btn.btn-sm, .btn.btn-small {
    padding: 0.3em 0.7em;
    font-size: 0.9em;
}

.btn-tiny, .btn.btn-tiny {
    padding: 0.2em 0.5em;
    font-size: 0.8em;
}

.btn-large, .btn.btn-large {
    padding: 0.8em 2em;
    font-size: 1.1em;
}

.btn-hero-primary {
    background: var(--color-blue);
    color: #fff !important;
    padding: 0.9rem 2.4rem;
    border-radius: 9px;
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none !important;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    display: inline-block;
    box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}

.btn-hero-primary:hover {
    background: var(--color-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.4);
}

.btn-hero-secondary {
    background: transparent;
    color: #cbd5e1 !important;
    padding: 0.9rem 2.4rem;
    border-radius: 9px;
    font-size: 1.05rem;
    font-weight: 600;
    text-decoration: none !important;
    border: 2px solid var(--color-slate-700);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    display: inline-block;
}

.btn-hero-secondary:hover {
    border-color: var(--color-slate-500);
    color: #fff !important;
    background: rgba(255,255,255,0.04);
}

/* --- Panels (logged-in page layout blocks) --- */
.panel {
    float: left;
    background-color: lightgray;
    padding: 1em;
    margin: 0 1em 1em 0;
    border-radius: 1em;
}

.panel li:not(:last-child) > input {
    margin-bottom: 0.5em;
}

.panel ul:not(:last-child) {
    margin-bottom: 1.5em;
}

.panel label {
    float: left;
    clear: both;
    margin-top: 0.5em;
}

.panel a:link, .panel a:visited {
    text-decoration: none;
    color: black;
}

/* --- Card — modern white card pattern (replacing .panel in redesigned pages) --- */
.card {
    background: var(--color-slate-50, #f8fafc);
    border: 1px solid var(--color-slate-200, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.07));
    margin-bottom: 1.25rem;
}

.card h2, .card h3 {
    margin-top: 0;
    color: var(--color-navy, #0f172a);
}

.card-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title-row h2,
.card-title-row h3 {
    margin: 0;
}

/* Panel width classes — collapse to 100% on narrow screens (see app.css) */
.full    { width: 100%; }
.wide_70 { width: calc(70% - 1em); }
.wide    { width: calc(60% - 1em); }
.narrow  { width: calc(40% - 1em); }
.narrow_30 { width: calc(30% - 1em); }

/* --- No-marker lists --- */
.noMarker {
    list-style-type: none;
}

.noMarker ul, .noMarker ol {
    padding-left: 0;
    margin-left: 0;
}

.noMarker li {
    list-style-type: none;
    display: table;
    width: 100%;
}

/* --- Data display --- */
.dataDisplay {
    margin-bottom: 0.5em;
    min-height: 1em;
}

/* --- Form helpers --- */
input.checkbox {
    width: auto;
}

input.buttonSubmit {
    float: right;
    width: auto;
}

.inputInvalid {
    color: red;
    float: right;
    padding-right: 3em;
}

.loginform {
    float: none;
    margin-left: auto;
    margin-right: auto;
    background-color: lightslategray;
}

/* --- Alert / section header --- */
.alert {
    padding: 0.75em 1em;
    border-radius: var(--radius-md);
    margin-bottom: 1em;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5em;
}

/* --- Tables --- */
table.list {
    border-width: 0.2em;
    border-style: solid;
    border-collapse: collapse;
    text-wrap-mode: nowrap;
}

.list th, .list td {
    text-align: left;
    padding: 0.1em 0.2em;
    border-width: 0.1em;
    border-style: solid;
}

/* Table sorting and filtering */
.sortable {
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.sort-icon::after { content: ' ↕'; opacity: 0.3; }
.sort-asc  .sort-icon::after { content: ' ↑'; opacity: 1; color: #007bff; }
.sort-desc .sort-icon::after { content: ' ↓'; opacity: 1; color: #007bff; }

.perm-filter {
    cursor: pointer;
    user-select: none;
    text-align: center !important;
}

.perm-filter .filter-icon::after { content: ' ▿'; opacity: 0.3; }
.perm-filter:hover { background-color: #eee; }

.perm-filter.filter-yes { background-color: #d4edda !important; }
.perm-filter.filter-yes .filter-icon::after { content: ' ✔'; opacity: 1; color: #28a745; }

.perm-filter.filter-no { background-color: #f8d7da !important; }
.perm-filter.filter-no .filter-icon::after { content: ' ✖'; opacity: 1; color: #dc3545; }

.filter-input {
    width: 100%;
    padding: 4px 8px !important;
    font-size: 0.9em !important;
    border: 1px solid #ccc;
    border-radius: var(--radius-sm);
}

.table-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5em;
    flex-wrap: wrap;
    gap: 0.5em;
}

.table-filter-header H2 { margin: 0; }

#memberSearch, #userSearch { width: 250px; }

/* --- Permission icons --- */
.perm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    user-select: none;
    border: 1px solid rgba(0,0,0,0.1);
}

.perm-yes { background-color: #28a745; color: black; }
.perm-yes::before { content: '✔'; }
.perm-no  { background-color: #dc3545; color: black; }
.perm-no::before  { content: '✖'; }
.perm-icon:hover { filter: brightness(0.9); box-shadow: 0 0 4px rgba(0,0,0,0.2); }

/* --- JS / no-JS --- */
.noscript-banner {
    background-color: #fff3cd;
    color: #856404;
    padding: 1em;
    text-align: center;
    border-bottom: 1px solid #ffeeba;
    font-weight: bold;
}

.no-js .js-only { display: none !important; }

.no-js .perm-icon {
    cursor: default;
    pointer-events: none;
    opacity: 0.6;
}

/* --- Modal --- */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show { display: flex; }

.modal-content {
    background-color: white;
    padding: 2em;
    border-radius: 0.5em;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* --- Notification bar --- */
#notificationBar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 2000;
    padding: 0;
}

.notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    padding: 0.6em 1em;
    font-size: 0.95em;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.notification-item:last-child {
    border-bottom: none;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.notification-link { color: white; text-decoration: none; flex: 1; }
.notification-link:hover { text-decoration: underline; }

.notification-dismiss {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1em;
    cursor: pointer;
    padding: 0.15em 0.5em;
    margin-left: 0.75em;
    line-height: 1;
    border-radius: 3px;
}

.notification-dismiss:hover { background: rgba(255,255,255,0.4); }
.no-js .notification-dismiss { display: none; }

/* --- Event cards --- */
.event-container {
    display: grid;
    grid-template-columns: 1fr;   /* default: 1 column; see container query in app.css */
    gap: 1em;
    margin-bottom: 0.5em;
}

.event-card {
    background-color: white;
    border-radius: 0.5em;
    padding: 1em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-left: 3px solid var(--color-slate-200, #e2e8f0);
}

.event-card.event-practice { border-left-color: #2563eb; }
.event-card.event-game     { border-left-color: #16a34a; }

.event-card h4 {
    margin-bottom: 0;
    color: #333;
    flex: 1 1 200px;
}

.event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5em;
}

.event-card-header h4 { margin: 0; flex: 1; }

.event-card-info {
    text-align: right;
    flex-shrink: 0;
    margin-left: 1em;
}

.club-name   { font-size: 0.8em; color: #666; font-weight: bold; }
.alley-name  { font-size: 0.8em; color: #888; display: block; }

.event-card .time   { font-size: 0.9em; color: #666; margin-bottom: 0.5em; }
.event-card .slots  { font-weight: bold; margin-bottom: 1em; }

.event-card .actions {
    margin-top: auto;
    display: flex;
    gap: 0.5em;
    align-items: center;
}

.event-card .status-msg {
    font-style: italic;
    color: #888;
    margin-left: auto;
}

.more-events-container {
    text-align: center;
    margin-top: 1em;
    width: 100%;
    clear: both;
}

/* Event page details */
.event-details-header {
    background-color: white;
    padding: 1.5em;
    border-radius: 0.5em;
    margin-bottom: 1em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    clear: both;
}

.event-details-header h2 { margin-bottom: 0; color: #333; flex: 1 1 200px; }

.event-details-header .meta {
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
}

.event-details-actions {
    margin-top: 1.5em;
    padding-top: 1em;
    border-top: 1px solid #eee;
}

/* --- Calendar --- */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
    background-color: white;
    padding: 1em;
    border-radius: 0.5em;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 0.5em;
    overflow: hidden;
    table-layout: fixed;
}

.calendar-table th {
    background-color: #eee;
    padding: 1em;
    text-align: center;
}

.calendar-table td {
    height: 6em;
    border: 1px solid #ddd;
    vertical-align: top;
    padding: 0.5em;
}

.calendar-day { position: relative; }
.day-number   { font-weight: bold; margin-bottom: 0.5em; }

.calendar-event {
    background-color: #e7f3ff;
    border-left: 3px solid #007bff;
    padding: 2px 4px;
    margin-bottom: 2px;
    font-size: 0.8em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event a { text-decoration: none; color: #0056b3; }

.calendar-fallback {
    background-color: white;
    padding: 1em;
    border-radius: 0.5em;
}

/* =============================================================
   Form utilities
   ============================================================= */
.form-group {
    margin-bottom: 0.75rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: var(--color-navy, #0f172a);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.form-row .form-group {
    margin-bottom: 0;
}
