/* ============================================================
   help module — contextual help icon, overlay, and panel
   ============================================================ */

/* ─── Help icon ─── */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary, #0f3460);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: 2px solid #1a5276;
    transition: background 0.2s, transform 0.2s;
    margin-left: 0.5rem;
    line-height: 1;
    user-select: none;
}
.help-icon:hover {
    background: var(--primary-hover, #1a5276);
    transform: scale(1.1);
}

/* ─── Help panel overlay ─── */
.help-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: none;
}
.help-panel-overlay.open {
    display: block;
}

/* ─── Help panel (slides in from right) ─── */
.help-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: var(--surface, #fff);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 1.5rem;
}
.help-panel.open {
    right: 0;
}

/* ─── Panel close button ─── */
.help-panel-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted, #666);
    line-height: 1;
    padding: 0.25rem 0.5rem;
}
.help-panel-close:hover {
    color: var(--text-main, #333);
}

/* ─── Panel title ─── */
.help-panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-right: 2rem; /* room for close button */
    color: var(--text-main, #333);
}

/* ─── Panel body content ─── */
.help-panel-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main, #333);
}
.help-panel-body p {
    margin-bottom: 0.75rem;
}
.help-panel-body ul,
.help-panel-body ol {
    padding-left: 1.25rem;
    margin-bottom: 0.75rem;
}
.help-panel-body li {
    margin-bottom: 0.25rem;
}

/* ============================================================
   Manage page — table, form, flash messages
   ============================================================ */

.help-manage {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.help-manage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.help-manage-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main, #333);
}

/* ─── Flash message ─── */
.help-flash {
    padding: 0.75rem 1rem;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    color: #155724;
    margin-bottom: 1rem;
}

/* ─── Validation errors ─── */
.help-errors {
    padding: 0.75rem 1rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    margin-bottom: 1rem;
}
.help-errors ul {
    margin: 0;
    padding-left: 1.25rem;
}
.help-errors li {
    margin-bottom: 0.25rem;
}

/* ─── Table ─── */
.help-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #dee2e6);
}
.help-table th,
.help-table td {
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border, #dee2e6);
    font-size: 0.9rem;
}
.help-table th {
    background: var(--bg-muted, #f8f9fa);
    font-weight: 600;
    color: var(--text-muted, #555);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}
.help-table code {
    font-size: 0.85rem;
    background: #f4f4f4;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

/* ─── Action buttons in table ─── */
.help-actions {
    white-space: nowrap;
}
.help-actions .inline-form {
    display: inline;
}

/* ─── Buttons ─── */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s, border-color 0.15s;
}
.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}
.btn-primary {
    background: var(--primary, #0f3460);
    color: #fff;
    border-color: var(--primary, #0f3460);
}
.btn-primary:hover {
    background: var(--primary-hover, #1a5276);
}
.btn-secondary {
    background: #6c757d;
    color: #fff;
    border-color: #6c757d;
}
.btn-secondary:hover {
    background: #5a6268;
}
.btn-edit {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}
.btn-edit:hover {
    background: #0069d9;
}
.btn-delete {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}
.btn-delete:hover {
    background: #c82333;
}

/* ─── Form ─── */
.help-form {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #dee2e6);
    border-radius: 6px;
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.375rem;
    font-size: 0.9rem;
    color: var(--text-main, #333);
}
.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid var(--border, #ced4da);
    border-radius: 4px;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.form-control:focus {
    border-color: var(--primary, #0f3460);
    outline: none;
    box-shadow: 0 0 0 2px rgba(15, 52, 96, 0.15);
}
.textarea-lg {
    min-height: 200px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding-top: 0.5rem;
}

.help-note {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-muted, #888);
}
