/* Mkind Labs - admin panel
   Mobile-first, standalone stylesheet (the admin panel does not load the
   public site's style.css). Tables become labelled cards below 720px so
   every column - including Actions - stays reachable without a horizontal
   scroll a phone user might never find. */

:root {
    --primary: #0e7c86;
    --primary-dark: #095a62;
    --accent: #ff6b57;
    --accent-dark: #e0523f;
    --ink: #1f2430;
    --muted: #667085;
    --border: #e2e5ea;
    --bg: #f5f6f8;
    --card: #ffffff;
    --success: #16a34a;
    --danger: #dc2626;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
}

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

a:hover {
    text-decoration: underline;
}

h1, h2 {
    margin: 0 0 6px;
}

/* ---------------------------------------------------------------------
   Top nav
   --------------------------------------------------------------------- */

.admin-nav {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.admin-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-brand {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--ink);
}

.admin-nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.admin-nav-toggle span {
    width: 18px;
    height: 2px;
    background: var(--ink);
    display: block;
}

#adminNavLinks {
    position: fixed;
    top: 61px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    padding: 8px 16px 24px;
    gap: 2px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    z-index: 19;
}

#adminNavLinks.open {
    transform: translateX(0);
}

#adminNavLinks a {
    padding: 13px 4px;
    border-bottom: 1px solid var(--border);
    color: var(--ink);
    font-weight: 600;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#adminNavLinks a.active {
    color: var(--primary);
}

.admin-user {
    padding: 13px 4px;
    color: var(--muted);
    font-size: 0.9rem;
}

.nav-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 1px 7px;
    line-height: 1.4;
}

@media (min-width: 960px) {
    .admin-nav-toggle {
        display: none;
    }

    #adminNavLinks {
        position: static;
        flex-direction: row;
        align-items: center;
        transform: none;
        padding: 0;
        overflow: visible;
        gap: 18px;
    }

    #adminNavLinks a,
    .admin-user {
        border-bottom: none;
        padding: 6px 2px;
        min-height: 0;
    }

    #adminNavLinks a:last-of-type {
        margin-left: auto;
    }
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    background: none;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: #fff;
    border-color: var(--border);
    color: var(--ink);
}

.btn-danger {
    background: #fff;
    border-color: var(--danger);
    color: var(--danger);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.82rem;
}

.link-danger {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0;
    font-size: 0.88rem;
    font-family: inherit;
}

.link-danger:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------------------------
   Toolbar / cards
   --------------------------------------------------------------------- */

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-toolbar h1 {
    font-size: 1.3rem;
}

.admin-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.mt-16 {
    margin-top: 16px;
}

.muted {
    color: var(--muted);
}

.d-flex {
    display: flex;
    flex-wrap: wrap;
}

.gap-8 {
    gap: 8px;
}

/* ---------------------------------------------------------------------
   Stat cards
   --------------------------------------------------------------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (min-width: 700px) {
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.stat-card.attention {
    border-color: var(--accent);
    background: #fff5f3;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
}

/* ---------------------------------------------------------------------
   Filters
   --------------------------------------------------------------------- */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-bar input {
    flex: 1 1 220px;
    min-width: 0;
}

/* ---------------------------------------------------------------------
   Tables -> cards on phones
   --------------------------------------------------------------------- */

.table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-weight: 700;
    background: #fafbfc;
}

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

.cell-strong {
    font-weight: 700;
}

.admin-thumb {
    width: 56px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.row-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

@media (max-width: 720px) {
    .table-wrap {
        background: none;
        border: none;
        border-radius: 0;
    }

    table {
        border-collapse: separate;
        border-spacing: 0;
    }

    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    tr {
        display: block;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 12px 16px;
        margin-bottom: 12px;
    }

    td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 7px 0;
        border-bottom: 1px solid var(--border);
        text-align: right;
    }

    td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: var(--muted);
        font-weight: 700;
        font-size: 0.76rem;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        text-align: left;
    }

    td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    td[data-label="Image"] {
        display: block;
    }

    td[data-label="Image"]::before {
        display: none;
    }

    .admin-thumb {
        width: 100%;
        height: 110px;
    }

    .row-actions {
        justify-content: flex-end;
    }
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */

form.stack label {
    display: block;
    margin: 14px 0 6px;
    font-size: 0.86rem;
    font-weight: 700;
}

form.stack label:first-of-type {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 20px;
}

@media (min-width: 640px) {
    .form-grid.cols-2 {
        grid-template-columns: 1fr 1fr;
    }

    .form-grid .full {
        grid-column: 1 / -1;
    }
}

label {
    display: block;
    font-size: 0.86rem;
    font-weight: 700;
    margin: 14px 0 6px;
}

label:first-child {
    margin-top: 0;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
    font-family: inherit;
    color: var(--ink);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #bfe3e2;
    border-color: var(--primary);
}

.hint {
    color: var(--muted);
    font-size: 0.8rem;
    margin-top: 4px;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 16px;
}

.checkbox-row input {
    width: 20px;
    height: 20px;
    min-height: 0;
    margin-top: 1px;
    flex-shrink: 0;
}

.checkbox-row label {
    margin: 0;
}

.current-image {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-image img {
    width: 140px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
}

@media (min-width: 640px) {
    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 960px) {
    .checkbox-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.checkbox-tile {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    background: #fff;
}

.checkbox-tile input {
    width: 18px;
    height: 18px;
    min-height: 0;
    flex-shrink: 0;
}

.icon-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

@media (min-width: 640px) {
    .icon-picker {
        grid-template-columns: repeat(4, 1fr);
    }
}

.icon-choice {
    position: relative;
}

.icon-choice input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.icon-choice span {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
}

.icon-choice svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
    flex-shrink: 0;
}

.icon-choice input:checked + span {
    border-color: var(--primary);
    background: #eef7f7;
}

/* ---------------------------------------------------------------------
   Card illustration picker (test_form.php / package_form.php)
   --------------------------------------------------------------------- */

.illustration-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 8px;
}

@media (min-width: 640px) {
    .illustration-picker {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 960px) {
    .illustration-picker {
        grid-template-columns: repeat(4, 1fr);
    }
}

.illustration-choice {
    position: relative;
}

.illustration-choice input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.illustration-choice span {
    display: block;
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
}

.illustration-choice img {
    display: block;
    width: 100%;
    height: auto;
}

.illustration-choice em {
    display: block;
    padding: 6px 8px;
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 600;
    color: var(--ink);
}

.illustration-choice input:checked + span {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px #bfe3e2;
}

.icon.icon-sm {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.kv-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 640px) {
    .kv-grid {
        grid-template-columns: 1fr 1fr;
    }

    .kv-grid .full {
        grid-column: 1 / -1;
    }
}

.kv-grid > div {
    font-size: 0.9rem;
}

.kv-grid span {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
}

/* ---------------------------------------------------------------------
   Alerts / badges
   --------------------------------------------------------------------- */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-sample_collected { background: #ede9fe; color: #5b21b6; }
.badge-report_ready { background: #dcfce7; color: #166534; }
.badge-completed { background: #e5e7eb; color: #374151; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* Where a booking came from - kept visually distinct from the status
   badges above so the two aren't mistaken for each other in the same row. */
.badge-source-web { background: #e5e7eb; color: #374151; }
.badge-source-admin { background: #cffafe; color: #0e7490; }

/* ---------------------------------------------------------------------
   Report list (booking_view.php)
   --------------------------------------------------------------------- */

.report-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.report-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-size: 0.87rem;
}

/* ---------------------------------------------------------------------
   Detail layout (booking_view.php)
   --------------------------------------------------------------------- */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 960px) {
    .detail-grid.with-sidebar {
        grid-template-columns: 2fr 1fr;
        align-items: start;
    }

    .sticky-book {
        position: sticky;
        top: 78px;
    }
}

/* ---------------------------------------------------------------------
   Auth pages (login / setup)
   --------------------------------------------------------------------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: linear-gradient(135deg, #eaf6f6, var(--bg));
}

.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px 26px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.auth-card h1 {
    margin: 0 0 6px;
    font-size: 1.25rem;
    text-align: center;
}

.auth-card p.subtitle {
    text-align: center;
    color: var(--muted);
    margin: 0 0 20px;
    font-size: 0.86rem;
}

.auth-card .btn-primary {
    margin-top: 18px;
}

.auth-foot {
    text-align: center;
    margin-top: 16px;
    font-size: 0.84rem;
    color: var(--muted);
}
