/* ── Admin Portal ─────────────────────────────────────────────── */

/* Tabs */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 5px;
    width: fit-content;
}

.admin-tab {
    padding: 9px 22px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-3);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.admin-tab:hover {
    background: var(--surface-2);
    color: var(--text-1);
}

.admin-tab.active {
    background: var(--accent);
    color: #fff;
}

/* User list */
.admin-user-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-user-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.15s;
}

.admin-user-row:hover {
    border-color: var(--border-strong);
}

.admin-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.admin-user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-email {
    font-size: 12px;
    color: var(--text-4);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.admin-user-date {
    font-size: 12px;
    color: var(--text-4);
    white-space: nowrap;
}

.admin-user-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Role badges */
.admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.admin-badge--admin {
    background: rgba(99, 102, 241, 0.18);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.admin-badge--user {
    background: var(--surface-2);
    color: var(--text-4);
    border: 1px solid var(--border);
}

/* Extra-small buttons */
.btn-xs {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

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

/* System stats */
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 8px;
}

.admin-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-align: center;
}

.admin-stat-icon {
    font-size: 22px;
    line-height: 1;
}

.admin-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.1;
}

.admin-stat-label {
    font-size: 12px;
    color: var(--text-4);
    font-weight: 500;
}

/* ── Instructions (admin grid) ───────────────────────────────── */

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

/* ── Instructions (public grid) ─────────────────────────────── */

.instr-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.instr-filter-btn {
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.instr-filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.instr-filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.instr-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.instr-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.instr-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}

.instr-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.instr-card-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.instr-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.3;
}

.instr-cat-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.2);
    white-space: nowrap;
}

.instr-card-header-actions {
    flex-shrink: 0;
}

.instr-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.instr-preview,
.instr-full {
    font-size: 13px;
    color: var(--text-3);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-align: left;
    width: fit-content;
}

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

.instr-card-preview {
    font-size: 13px;
    color: var(--text-3);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.instr-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.instr-card-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-soft);
    padding-top: 10px;
}

.instr-date {
    font-size: 11px;
    color: var(--text-4);
}

/* nav admin item accent */
.nav-item--admin {
    color: #a5b4fc;
}

.nav-item--admin.active,
.nav-item--admin:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
}

/* ── Instruction active/inactive states ─────────────────────── */

.instr-card--inactive {
    opacity: 0.55;
    border-style: dashed;
}

.instr-card--inactive:hover {
    opacity: 0.75;
}

.instr-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-strong);
    flex-shrink: 0;
    transition: background 0.15s;
}

.instr-status-dot--on {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(28, 184, 112, 0.18);
}

.instr-active-count {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(28, 184, 112, 0.14);
    color: var(--success);
    border: 1px solid rgba(28, 184, 112, 0.24);
    white-space: nowrap;
}

/* ── GPT Export Panel ────────────────────────────────────────── */

.instr-export-textarea {
    width: 100%;
    min-height: 200px;
    max-height: 420px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-2);
    font-size: 12.5px;
    font-family: ui-monospace, "Cascadia Code", "Fira Mono", monospace;
    line-height: 1.65;
    resize: vertical;
    box-sizing: border-box;
}

.instr-export-textarea:focus {
    outline: none;
    border-color: rgba(249, 115, 22, 0.45);
}
