/* ============================================================
   Mitgliederverwaltung – Stylesheet
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --primary:        #2563eb;
    --primary-dark:   #1d4ed8;
    --primary-light:  #dbeafe;
    --danger:         #ef4444;
    --danger-dark:    #dc2626;
    --success-bg:     #d1fae5;
    --success-text:   #065f46;
    --success-border: #a7f3d0;
    --error-bg:       #fee2e2;
    --error-text:     #991b1b;
    --error-border:   #fca5a5;
    --bg:             #f1f5f9;
    --card-bg:        #ffffff;
    --border:         #e2e8f0;
    --text:           #0f172a;
    --text-muted:     #64748b;
    --radius:         10px;
    --shadow:         0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --font:           'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---- Base ---- */
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    line-height: 1.6;
}

/* ---- Container ---- */
.container {
    width: fit-content;
    min-width: 320px;
    max-width: calc(100vw - 48px);
    margin: 24px auto;
    padding: 28px 32px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

@media (max-width: 960px) {
    .container {
        max-width: calc(100vw - 32px);
        margin: 16px auto;
        padding: 20px;
    }
}

@media (max-width: 600px) {
    .container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 16px;
        min-height: 100vh;
    }
}

/* ---- Typography ---- */
h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 20px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin: 28px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary-light);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ---- Tables ---- */
table {
    width: auto;
    border-collapse: collapse;
    font-size: 16px;
    white-space: nowrap;
    margin-bottom: 8px;
}

th {
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    text-align: left;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}

tbody tr:last-child {
    border-bottom: none;
}

tr:not(:has(th)):nth-child(even) {
    background: #f8fafc;
}

tr:not(:has(th)):hover {
    background: var(--primary-light);
}

td {
    padding: 9px 14px;
    vertical-align: middle;
}

/* Horizontal scroll on small screens */
@media (max-width: 900px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ---- Links ---- */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ---- Buttons ---- */
button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s, border-color .15s;
    white-space: nowrap;
    line-height: 1;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,.10);
}

button:active {
    transform: translateY(0);
    box-shadow: none;
}

button.add-member,
button.main {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 60%, #1d4ed8 100%);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 9px 20px;
    font-weight: 600;
    letter-spacing: .02em;
    box-shadow: 0 2px 8px rgba(37,99,235,.35);
}

button.add-member:hover,
button.main:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 60%, #1e40af 100%);
    box-shadow: 0 5px 16px rgba(37,99,235,.45);
}

button.logout {
    background: var(--danger);
    color: #fff;
}

button.logout:hover {
    background: var(--danger-dark);
}

button.update-group {
    background: #f8fafc;
    color: var(--text);
    border-color: var(--border);
    padding: 7px 16px;
    font-weight: 600;
}

button.update-group:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

/* ---- Action Buttons Row ---- */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    margin-bottom: 8px;
}

@media (max-width: 600px) {
    .action-buttons {
        gap: 8px;
    }
    .action-buttons button {
        flex: 1 1 calc(50% - 4px);
        justify-content: center;
        padding: 9px 8px;
        font-size: 13px;
    }
}

/* ---- Form Sections ---- */
.form-section {
    margin-bottom: 8px;
}

.form-section > div {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 6px 16px;
    margin-bottom: 10px;
}

.form-section > div label {
    margin: 0;
    text-align: right;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .form-section > div {
        grid-template-columns: 1fr;
    }

    .form-section > div label {
        text-align: left;
    }
}

/* ---- Inputs ---- */
label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    font-family: var(--font);
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

input[type="file"] {
    padding: 6px 10px;
    cursor: pointer;
}

/* ---- Alert messages ---- */
.success-message {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-weight: 500;
}

p[style*="color: red"],
p[style*="color:red"] {
    background: var(--error-bg) !important;
    color: var(--error-text) !important;
    border: 1px solid var(--error-border);
    border-radius: 6px;
    padding: 10px 14px;
    font-weight: 500;
}

/* ---- Page Logo (right-aligned, all pages except login) ---- */
.page-logo {
    float: right;
    height: 44px;
    width: auto;
    margin: -4px 0 8px 16px;
}

/* ---- Mobile/Desktop visibility helpers ---- */
.d-mobile  { display: none !important; }
.d-desktop { display: block; }

@media (max-width: 600px) {
    .d-mobile  { display: block !important; }
    .d-desktop { display: none !important; }
}

/* ---- Member Cards (mobile list) ---- */
.member-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.member-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    transition: background .12s;
}

.member-card:active {
    background: var(--primary-light);
}

.member-card-photo { flex-shrink: 0; }

.member-card-body {
    flex: 1;
    min-width: 0;
}

.member-card-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-card-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.member-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
}

/* ---- Dashboard Header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.page-header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    min-width: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.page-header-actions .header-logo {
    height: 44px;
    width: auto;
    margin-left: 4px;
}

@media (max-width: 600px) {
    .page-header {
        flex-wrap: wrap;
    }
    .page-header-title {
        font-size: 1.05rem;
        flex: 1 1 100%;
        order: 2;
        padding-top: 8px;
        border-top: 1px solid var(--border);
        margin-top: 4px;
    }
    .page-header-actions {
        order: 1;
        width: 100%;
        justify-content: flex-end;
    }
    .page-header-actions button {
        padding: 8px 12px;
        font-size: 13px;
    }
    .page-header-actions .header-logo {
        height: 36px;
    }
}

/* ---- Navigation Section ---- */
.nav-section {
    background: var(--bg);
    border-radius: 14px;
    padding: 14px;
    margin: 8px 0 28px;
    border: 1px solid var(--border);
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

/* Per-tile colour tokens */
.nav-tile[data-color="blue"]   { --tc: #2563eb; --tb: #dbeafe; }
.nav-tile[data-color="amber"]  { --tc: #d97706; --tb: #fef3c7; }
.nav-tile[data-color="green"]  { --tc: #059669; --tb: #d1fae5; }
.nav-tile[data-color="red"]    { --tc: #dc2626; --tb: #fee2e2; }
.nav-tile[data-color="purple"] { --tc: #7c3aed; --tb: #ede9fe; }
.nav-tile[data-color="teal"]   { --tc: #0891b2; --tb: #cffafe; }

.nav-tile {
    --tc: var(--primary);
    --tb: var(--primary-light);

    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 12px 15px;
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    font-family: var(--font);
    text-align: center;
    line-height: 1.3;
    transition: border-color .18s, box-shadow .18s, transform .18s, color .18s;
    appearance: none;
    -webkit-appearance: none;
    overflow: hidden;
}

/* coloured left-edge accent bar */
.nav-tile::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--tc);
    border-radius: 12px 0 0 12px;
    opacity: 0;
    transition: opacity .18s;
}

.nav-tile:hover,
.nav-tile:focus {
    border-color: var(--tc);
    box-shadow: 0 6px 20px rgba(0,0,0,.09);
    transform: translateY(-3px);
    color: var(--tc);
    text-decoration: none;
    outline: none;
}

.nav-tile:hover::after,
.nav-tile:focus::after,
.nav-tile.active::after {
    opacity: 1;
}

.nav-tile:active {
    transform: translateY(0);
    box-shadow: none;
}

.nav-tile.active {
    border-color: var(--tc);
    background: var(--tb);
    color: var(--tc);
}

.nav-tile-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--tb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    transition: transform .18s;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.nav-tile:hover .nav-tile-icon {
    transform: scale(1.1) rotate(-4deg);
}

.nav-tile-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    color: inherit;
}

@media (max-width: 600px) {
    .nav-section {
        padding: 10px;
    }
    .nav-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 7px;
    }
    .nav-tile {
        padding: 14px 6px 12px;
        gap: 8px;
        border-radius: 10px;
    }
    .nav-tile::after {
        border-radius: 10px 0 0 10px;
    }
    .nav-tile-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
        border-radius: 11px;
    }
    .nav-tile-label {
        font-size: 11px;
    }
}

/* ---- Admin Cards ---- */
.admin-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin-top: 20px;
}

.admin-card h3 {
    margin-top: 0;
}

.admin-card table {
    width: 100%;
}

/* Warn / Danger buttons */
button.warn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(217,119,6,.3);
}
button.warn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 4px 12px rgba(217,119,6,.4);
}

button.danger {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(220,38,38,.3);
}
button.danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 12px rgba(220,38,38,.4);
}

/* Status pill */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-pill.ok   { background: #d1fae5; color: #065f46; }
.status-pill.warn { background: #fee2e2; color: #991b1b; }

/* ---- Login page ---- */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

body.login-page .container {
    width: 100%;
    max-width: 420px;
    margin: 0;
    padding: 40px 36px;
    border-radius: var(--radius);
}

body.login-page h2 {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 28px;
}

body.login-page form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

body.login-page form label {
    margin-bottom: 4px;
}

body.login-page button[type="submit"] {
    width: 100%;
    justify-content: center;
    padding: 11px;
    font-size: 15px;
    background: var(--primary);
    color: #fff;
    margin-top: 4px;
}

body.login-page button[type="submit"]:hover {
    background: var(--primary-dark);
}
