/* ============================================================
   ROOT THEME VARIABLES
============================================================ */
:root {
    --bg-body: #f3f4f6;
    --bg-header: #111827;
    --bg-sidebar: #1f2933;
    --bg-card: #ffffff;

    --text-main: #111827;
    --text-light: #e5e7eb;

    --accent: #06b6d4;
    --accent-soft: rgba(6, 182, 212, 0.12);

    --border-subtle: #e5e7eb;
    --danger: #dc2626;

    --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.05);
    --radius-lg: 12px;
}

/* ============================================================
   GLOBAL RESET
============================================================ */
* {
    box-sizing: border-box;
}
.search-wrapper {
    position: relative;
    display: inline-block;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    display: none; /* hidden until text exists */
}

.search-clear-btn:hover {
    color: #6b7280;
}

body {
    margin: 0;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
}

a {
    color: inherit;
    text-decoration: none;
}
button {
    font-family: inherit;
}

/* ============================================================
   LAYOUT SHELL
============================================================ */
.layout {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.main-area {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 0;
}

/* ============================================================
   HEADER
============================================================ */
header {
    background: var(--bg-header);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    gap: 1rem;
}

header h1 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

header h1 .logo-pill {
    background: var(--bg-sidebar);
    padding: 0.12rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.user-pill {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(31, 41, 55, 0.7);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.user-pill .avatar {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, #06b6d4, #0ea5e9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    font-weight: 600;
}

.logout-btn {
    border: 1px solid rgba(249, 250, 251, 0.2);
    background: transparent;
    color: var(--text-light);
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.logout-btn:hover {
    background: rgba(15, 23, 42, 0.9);
}

/* ============================================================
   SIDEBAR
============================================================ */
.sidebar {
    background: var(--bg-sidebar);
    color: var(--text-light);
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.sidebar-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    opacity: 0.6;
    padding: 0 0.25rem;
    letter-spacing: 0.09em;
}

.nav-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    padding: 0.75rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.nav-item span.icon {
    font-size: 1rem;
}

.nav-item.active {
    background: rgba(15, 118, 110, 0.35);
    border-color: rgba(45, 212, 191, 0.4);
}

.nav-item:hover:not(.active) {
    background: rgba(15, 23, 42, 0.7);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(55, 65, 81, 0.9);
    padding-top: 0.75rem;
    opacity: 0.7;
    font-size: 0.75rem;
}

/* ============================================================
   CONTENT AREA
============================================================ */
.content-area {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.page-header h2 {
    margin: 0;
    font-size: 1.4rem;
}

.page-header p {
    margin: 0.15rem 0 0;
    font-size: 0.9rem;
    color: #4b5563;
}

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

/* ============================================================
   BUTTONS - PRIMARY / SUBTLE
============================================================ */
.btn-primary {
    background: linear-gradient(135deg, #06b6d4, #0ea5e9);
    color: white;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.35);
}
.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-subtle {
    background: white;
    border: 1px solid var(--border-subtle);
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* ============================================================
   FILTERS / FORM CONTROLS
============================================================ */
.filters-card {
    background: var(--bg-card);
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.filters-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.field-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
}

.input,
.select {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: white;
}

.input {
    min-width: 280px;
}
.select {
    min-width: 130px;
}

/* ============================================================
   CARDS & TABLE WRAPPERS
============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-size: 1rem;
}

.card-subtitle,
.card-meta {
    margin: 0;
    font-size: 0.8rem;
    color: #6b7280;
}

.table-wrapper {
    overflow-x: auto;
    margin-top: 0.3rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 720px;
}

thead {
    background: #f9fafb;
}

th,
td {
    padding: 0.5rem 0.4rem;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.06em;
}

tbody tr:hover {
    background: #f9fafb;
}

/* ============================================================
   TAGS / STATUS PILL
============================================================ */
.tag {
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: #ecfeff;
    color: #0e7490;
    border: 1px solid #a5f3fc;
}

.tag-paid {
    background: #ecfeff;
    color: #0e7490;
    border-color: #a5f3fc;
}

.tag-unpaid {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

/* ============================================================
   INLINE EDIT + ACTION BUTTONS
============================================================ */
.inline-edit-input {
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    width: 100%;
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.action-btn {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    background: white;
    font-size: 0.75rem;
    transition: 0.2s ease;
}

.action-btn.edit {
    color: #4b5563;
}
.action-btn.edit:hover {
    background: #f3f4f6;
}

.action-btn.save {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}
.action-btn.save:hover {
    filter: brightness(1.05);
}

.action-btn.cancel {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}
.action-btn.cancel:hover {
    filter: brightness(1.05);
}

.action-btn.delete {
    border-color: rgba(248, 113, 113, 0.6);
    color: var(--danger);
}
.action-btn.delete:hover {
    background: #fee2e2;
}
/* ACTION BUTTON RESTORE — matches old coloured design */
.actions button[data-action] {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: 0.2s ease;
    background: white;
}

/* VIEW (soft blue) */
.actions button[data-action="view"] {
    background: #e3f2fd;
    color: #1e88e5;
    border-color: #90caf9;
}
.actions button[data-action="view"]:hover {
    filter: brightness(1.05);
}

.actions button[data-action="save"] {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}
.actions button[data-action="save"]:hover {
    filter: brightness(1.05);
}
/* EDIT (soft amber) */
.actions button[data-action="edit"] {
    color: #4b5563;
    border-color: #4b5563;
}
.actions button[data-action="edit"]:hover {
    filter: brightness(1.05);
}
/*CANCEL*/
.actions button[data-action="cancel"] {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}
.actions button[data-action="cancel"]:hover {
    filter: brightness(1.05);
}
/* DELETE (soft red) */
.actions button[data-action="delete"] {
    background: #ffebee;
    color: #c62828;
    border-color: #ef9a9a;
}
.actions button[data-action="delete"]:hover {
    filter: brightness(1.05);
}

/* ============================================================
   ROW ANIMATIONS
============================================================ */
@keyframes flashSuccess {
    0% {
        background: #d1fae5;
    }
    100% {
        background: transparent;
    }
}
@keyframes flashCancel {
    0% {
        background: #fde68a;
    }
    100% {
        background: transparent;
    }
}

.flash-success {
    animation: flashSuccess 0.8s ease;
}
.flash-cancel {
    animation: flashCancel 0.8s ease;
}

/* ============================================================
   MODAL SYSTEM
============================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    border-radius: 20px;
    position: relative;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    opacity: 0.6;
    cursor: pointer;
}

/* ============================================================
   ACTIONS DROPDOWN
============================================================ */
.actions-dropdown {
    position: relative;
}

.actions-btn {
    background: #eee;
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}

.actions-menu {
    position: absolute;
    top: 35px;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 180px;
}
.actions-menu.hidden {
    display: none;
}

.actions-menu button {
    width: 100%;
    padding: 12px 18px;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.95rem;
    cursor: pointer;
}
.actions-menu button:hover {
    background: #f5f5f5;
}

.danger {
    color: #c62828 !important;
}

/* ============================================================
   MEMBER CARD
============================================================ */
.member-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.member-card-row {
    display: flex;
    margin-bottom: 18px;
}

.member-card-row .label {
    width: 160px;
    font-weight: 600;
}

.member-card-row .value a {
    color: #2855dd;
    text-decoration: underline;
}

/* ============================================================
   PAYMENT BADGE
============================================================ */
.badge-paid {
    background: #e0f2f1;
    color: #00796b;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
}

/* ============================================================
   HAMBURGER (BetButter Style)
============================================================ */
.modal-burger {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: 0.2s ease;
}

.modal-burger:hover {
    background: rgba(0, 0, 0, 0.1);
}

.modal-burger span {
    width: 22px;
    height: 2.5px;
    background: #444;
    border-radius: 2px;
    transition: 0.2s ease;
}

.modal-burger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.modal-burger.active span:nth-child(2) {
    opacity: 0;
}
.modal-burger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 900px) {
    .main-area {
        grid-template-columns: 1fr;
    }
    .sidebar {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 1rem;
    }
    .nav-list {
        flex-direction: row;
        flex-wrap: nowrap;
    }
    .sidebar-footer {
        display: none;
    }
}

@media (max-width: 640px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .filters-card,
    .filters-group,
    .input,
    .select {
        width: 100%;
    }
}
/* -------- Modal base -------- */

.mm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
}

.mm-hidden {
    display: none !important;
}

.mm-shell {
    max-width: 960px;
    width: 100%;
    padding: 1.5rem;
}

.mm-card {
    background: #ffffff;
    border-radius: 24px;
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.19),
        0 0 0 1px rgba(15, 23, 42, 0.04);
    padding: 1.75rem 2rem 1.5rem;
    max-height: min(720px, 90vh);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* -------- Header -------- */

.mm-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.mm-title-block {
    max-width: 100%;
}

.mm-eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6b7280;
    margin: 0 0 0.25rem;
}

.mm-name {
    font-size: 1.6rem;
    font-weight: 640;
    letter-spacing: -0.01em;
    margin: 0 0 0.25rem;
    color: #111827;
}

.mm-id {
    font-size: 0.8rem;
    color: #9ca3af;
    margin: 0;
    word-break: break-all;
}

.mm-header-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* -------- Icon buttons & menu -------- */

.mm-icon-btn {
    border: none;
    background: #f3f4f6;
    border-radius: 999px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background 0.15s ease,
        transform 0.1s ease;
}

.mm-icon-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.mm-close-btn {
    font-size: 1.4rem;
    line-height: 1;
    color: #4b5563;
}

.mm-menu-wrapper {
    position: relative;
}

.mm-menu {
    position: absolute;
    right: 0;
    top: 110%;
    min-width: 190px;
    background: #ffffff;
    border-radius: 0.9rem;
    box-shadow:
        0 12px 30px rgba(15, 23, 42, 0.18),
        0 0 0 1px rgba(15, 23, 42, 0.04);
    padding: 0.35rem 0;
    z-index: 1100;
}

.mm-menu-item {
    width: 100%;
    padding: 0.55rem 0.95rem;
    text-align: left;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    color: #111827;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.mm-menu-item:hover {
    background: #f3f4f6;
}

.mm-menu-danger {
    color: #b91c1c;
}

/* Simple menu icon */
.mm-icon-menu,
.mm-icon-menu::before,
.mm-icon-menu::after {
    content: "";
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: #111827;
    position: relative;
}

.mm-icon-menu::before {
    position: absolute;
    top: -5px;
}

.mm-icon-menu::after {
    position: absolute;
    top: 5px;
}

/* -------- Body layout -------- */

.mm-body {
    flex: 1 1 auto;
    overflow: auto;
    border-top: 1px solid #f3f4f6;
    border-bottom: 1px solid #f3f4f6;
    padding: 1.25rem 0;
}

.mm-columns {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 1.5rem;
}

.mm-column {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.mm-column-right {
    gap: 0.9rem;
}

.mm-field {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.mm-field-inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.mm-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #9ca3af;
}

.mm-value {
    font-size: 0.95rem;
    color: #111827;
}

.mm-value-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* subcards */

.mm-subcard {
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    padding: 0.75rem 0.9rem;
    background: #f9fafb;
}

.mm-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4b5563;
    margin: 0 0 0.35rem;
}

/* -------- Footer & buttons -------- */

.mm-footer {
    padding-top: 1rem;
    display: flex;
    justify-content: flex-start;
}

.mm-btn {
    border-radius: 999px;
    font-size: 0.9rem;
    padding: 0.55rem 1.1rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.mm-btn-secondary {
    background: #111827;
    color: #ffffff;
}

.mm-btn-secondary:hover {
    background: #020617;
}

/* -------- Badges (reuse your existing palette) -------- */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.paid {
    background: #e0f2f1;
    color: #00796b;
}

.badge.unpaid {
    background: #ffebee;
    color: #c62828;
}

/* -------- Accessibility helpers -------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* -------- Responsive -------- */

@media (max-width: 768px) {
    .mm-shell {
        padding: 0.75rem;
    }

    .mm-card {
        padding: 1.25rem 1.25rem 1rem;
        border-radius: 18px;
    }

    .mm-columns {
        grid-template-columns: 1fr;
    }

    .mm-header {
        flex-direction: column-reverse;
        align-items: flex-start;
    }

    .mm-header-actions {
        align-self: flex-end;
    }
}
/* -------- Recycle Bin -------- */
.age-green {
    background: #e6f4ea;
    color: #1e7d32;
    padding: 3px 8px;
    border-radius: 6px;
}

.age-orange {
    background: #fff4e5;
    color: #e69500;
    padding: 3px 8px;
    border-radius: 6px;
}

.age-red {
    background: #ffebee;
    color: #c62828;
    padding: 3px 8px;
    border-radius: 6px;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
}
