/* === Global layout === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Make page take full height for sticky footer */
html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    background: #f3f5f7;
    color: #222;
}

/* Wrapper for header + main + footer (opened in header.php, closed in footer.php) */
.layout-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.site-header {
    background: #0f172a;
    color: #fff;
    padding: 30px 16px;
}

.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.site-title-block {
    display: flex;
    flex-direction: column;
}

.site-title {
    font-weight: 600;
    font-size: 20px;
}

.site-subtitle {
    font-size: 14px;
    opacity: 0.8;
}

/* Navigation container */
.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.site-nav a {
    color: #e5e7eb;
    text-decoration: none;
    font-size: 13px;
}

.site-nav a:hover {
    text-decoration: underline;
}

/* Desktop layout for site header */
@media (min-width: 768px) {
    .site-header-inner {
        position: relative;
        padding: 10px 16px;
    }

    /* Center logo + title block */
    .site-brand {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    /* Navigation on the right side */
    .site-nav {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        justify-content: flex-end;
    }
}

/* Main content area inside header/footer - mobile first */
.site-main {
    flex: 1 0 auto;              /* for sticky footer */
    max-width: 1100px;
    margin: 20px auto;           /* centered on mobile and small screens */
    padding: 0 16px 40px;
    display: block;
}

/* Desktop layout */
@media (min-width: 1200px) {
    .site-main {
        margin: 20px 403px;      /* your custom desktop side margins */
    }
}


/* Footer */
.site-footer {
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    margin-top: auto;            /* push footer to bottom when content is short */
}

.site-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 16px 20px;
    font-size: 12px;
    color: #6b7280;
}

/* === Page header === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.page-title {
    margin: 0;
    font-size: 20px;
    margin-bottom: 20px;
}

.page-actions {
    display: flex;
    gap: 8px;
}

/* === Buttons & inputs === */
.btn {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid transparent;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    background: #0f766e;
    color: #fff;
}

.btn:hover {
    background: #115e59;
}

.btn-small {
    padding: 4px 18px;
    font-size: 14px;
}

.btn-primary {
    background: #2563eb;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-danger {
    background: #b91c1c;
}

.btn-danger:hover {
    background: #991b1b;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}

input:focus,
select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37,99,235,0.3);
}

/* === Forms === */
.form-vertical {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
    margin-bottom: 20px;
    margin-top: 30px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
}

.form-group {
    flex: 1 1 220px;
}

.form-group label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    font-weight: 500;
}

.form-actions {
    margin-top: 10px;
}

/* === Tables === */
.table-basic {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}

.table-basic th,
.table-basic td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: left;
    font-size: 13px;
}

.table-basic thead {
    background: #f3f4f6;
}

.table-basic th {
    font-weight: 600;
}

/* === Alerts === */
.alert {
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}

.alert-success {
    background: #ecfdf5;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* === Empty state === */
.empty-state {
    padding: 14px 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
    font-size: 13px;
}

/* === Search bar === */
.search-bar {
    margin-bottom: 14px;
}

.search-form label {
    font-size: 13px;
    margin-bottom: 4px;
    display: block;
}

.search-input-row {
    display: flex;
    gap: 8px;
}

/* === Public link input === */
.public-link-input {
    width: 100%;
    max-width: 340px;
    font-family: monospace;
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
}

/* === Pagination === */
.pagination {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.page-link,
.page-current {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
}

.page-link {
    border: 1px solid #d1d5db;
    color: #374151;
    background: #fff;
}

.page-link:hover {
    background: #f3f4f6;
}

.page-current {
    background: #2563eb;
    color: #fff;
}

/* === Auth / login === */
.auth-container {
    max-width: 400px;
    margin: 40px auto;
}

.auth-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px 16px 20px;
    box-shadow: 0 1px 4px rgba(15,23,42,0.12);
}

.auth-title {
    margin: 0 0 4px;
    font-size: 20px;
    text-align: center;
}

.auth-subtitle {
    margin: 0 0 12px;
    font-size: 12px;
    text-align: center;
    color: #6b7280;
}

/* === Responsive tables for mobile === */
@media (max-width: 768px) {

    /* Make table text a bit smaller on mobile */
    .table-basic th,
    .table-basic td {
        padding: 4px 6px;
        font-size: 12px;
    }

    /* Wrapper that allows horizontal scroll when needed */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
    }

    .table-responsive .table-basic {
        min-width: 600px; /* keep columns readable, scroll on small screens */
    }

    /* Compact action buttons in table cells */
    .table-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .table-actions .btn {
        flex: 1 1 calc(50% - 4px); /* two buttons per row */
        padding: 4px 4px;
        font-size: 11px;
        text-align: center;
    }

    /* Danger button usually go full width (Delete) */
    .table-actions .btn-danger {
        flex-basis: 100%;
    }

    /* Make public link text a bit smaller */
    .public-link-input {
        font-size: 10px;
    }
}

/* === Patient results header (title + buttons) === */
.patient-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.patient-results-header-title {
    margin: 0;
}

.patient-results-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Mobile layout for patient results header */
@media (max-width: 768px) {
    .patient-results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .patient-results-header-actions {
        width: 100%;
    }

    .patient-results-header-actions .btn {
        flex: 1 1 48%;
        text-align: center;
    }
}
/* Copy feedback hint next to public link */
.copy-hint {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    color: #16a34a; /* green */
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.15s ease;
}

.copy-hint.is-visible {
    opacity: 1;
}
.public-link-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-hint {
    display: inline-block;
    font-size: 11px;
    color: #16a34a;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.15s ease;
}

.copy-hint.is-visible {
    opacity: 1;
}
.btn-secondary {
    background: #109700;
}

.btn-secondary:hover {
    background: #0c6f00;
}

/* Inline form inside table actions */
.inline-form {
    display: inline-block;
    margin: 0;
}

.inline-form button {
    margin: 0;
}

