/* addParentPanel.css — Add parent slide-in panel */

/* ── Panel shell ─────────────────────────────────────────────────────────── */

.app-panel {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 420px;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.22);
    z-index: 8500;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
    font-size: 14px;
    color: #1f2328;
}

.app-panel.visible {
    display: flex;
    animation: app-panel-slide-in 0.2s ease-out;
}

@keyframes app-panel-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0);    }
}

/* ── Header — dark bar matching the Add Person modal ────────────────────── */

.app-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    background: #1e1e2e;          /* same dark as the modal header */
    flex-shrink: 0;
}

.app-panel-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 44px);
    letter-spacing: -0.01em;
}

.app-panel-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.12s, background 0.12s;
}

.app-panel-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

/* ── Subtitle — child name, sits inside the dark header ─────────────────── */

.app-panel-subtitle {
    margin: 0;
    /* Continues visually from the dark header — no extra box */
    padding: 0 20px 14px;
    font-size: 14px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.65);
    background: #1e1e2e;
    flex-shrink: 0;
    border-bottom: 3px solid #2da44e;   /* green accent line — same as Save button */
}

/* ── Body ────────────────────────────────────────────────────────────────── */

.app-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 8px;
    -webkit-overflow-scrolling: touch;
}

/* ── Form rows ───────────────────────────────────────────────────────────── */

.app-row {
    margin-bottom: 18px;
}

/* Labels: bold, sentence-case, full dark — matches the Add Person modal */
.app-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1f2328;
    margin-bottom: 6px;
}

.app-required { color: #cf222e; }

/* Inputs: match the Add Person modal padding and radius */
.app-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: #1f2328;
    background: #fff;
    box-sizing: border-box;
    min-height: 44px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.app-input:focus {
    outline: none;
    border-color: #3b82d4;
    box-shadow: 0 0 0 3px rgba(59, 130, 212, 0.15);
}

.app-input::placeholder { color: #9ca3af; }

/* Location typeahead container */
.app-location-wrap {
    position: relative;
}

.app-location-wrap .ap-location-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
}

/* ── Radio groups ────────────────────────────────────────────────────────── */

.app-radio-group {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 4px 0 2px;
}

.app-radio-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 500;
    color: #1f2328;
    cursor: pointer;
    min-height: 40px;
}

.app-radio-label input[type="radio"] {
    accent-color: #2da44e;
    width: 17px;
    height: 17px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Mode toggle ─────────────────────────────────────────────────────────── */

.app-mode-toggle {
    display: flex;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.app-mode-btn {
    flex: 1;
    padding: 10px 10px;
    background: #f7f8fa;
    color: #57606a;
    border: none;
    border-right: 1px solid #d0d7de;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, color 0.12s;
}

.app-mode-btn:last-child { border-right: none; }

.app-mode-btn--active {
    background: #fff;
    color: #1f2328;
    font-weight: 700;
    box-shadow: inset 0 -2px 0 #2da44e;   /* green underline on active tab */
}

.app-mode-btn:not(.app-mode-btn--active):hover {
    background: #fff;
    color: #1f2328;
}

/* ── Existing person search results ─────────────────────────────────────── */

.app-search-results {
    margin-top: 8px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    overflow: hidden;
    max-height: 220px;
    overflow-y: auto;
}

.app-search-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.1s;
}

.app-search-item:last-child { border-bottom: none; }
.app-search-item:hover { background: #f0fdf4; }

.app-search-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2328;
}

.app-search-meta {
    font-size: 12px;
    color: #57606a;
    margin-top: 2px;
}

.app-search-loading,
.app-no-results {
    padding: 12px 14px;
    font-size: 13px;
    color: #57606a;
}

/* ── Selected person chip ────────────────────────────────────────────────── */

.app-selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 20px;
    padding: 6px 12px 6px 16px;
    margin-top: 8px;
}

.app-selected-name {
    font-size: 14px;
    font-weight: 600;
    color: #15803d;
}

.app-selected-clear {
    background: none;
    border: none;
    color: #15803d;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    border-radius: 50%;
    transition: background 0.1s;
}

.app-selected-clear:hover { background: rgba(21, 128, 61, 0.12); }

/* ── Footer — full-width Save button matching the Add Person modal ───────── */

.app-panel-footer {
    padding: 0;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.app-save-btn {
    display: block;
    width: 100%;
    padding: 16px 20px;
    background: #2da44e;
    color: #fff;
    border: none;
    border-radius: 0;                /* flush with panel edges */
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    min-height: 52px;
    transition: background 0.15s;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.app-save-btn:hover:not(:disabled) { background: #2c974b; }
.app-save-btn:disabled {
    opacity: 0.6;
    cursor: default;
    background: #2da44e;
}

/* ── Status bar ──────────────────────────────────────────────────────────── */

.app-status {
    min-height: 0;
    font-size: 13px;
    padding: 0 20px;
    line-height: 1.5;
    flex-shrink: 0;
}

.app-status:not(:empty) {
    padding: 10px 20px;
    border-top: 1px solid #e5e7eb;
}

.app-status--success { color: #15803d; background: #f0fdf4; }
.app-status--error   { color: #cf222e; background: #ffebe9; }
.app-status--info    { color: #0550ae; background: #ddf4ff; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .app-panel {
        max-width: 100%;
    }

    .app-panel-title { font-size: 18px; }

    .app-input,
    .app-radio-label,
    .app-mode-btn {
        font-size: 16px; /* prevents iOS zoom on focus */
        min-height: 44px;
    }
}
