/* =============================================
   Kubernetes YAML Inspector — style.css
   DevOps dark theme, green/amber/red report status
   ============================================= */

:root {
    --bg: #0a0e17;
    --surface: #111827;
    --surface-2: #1a2235;
    --border: #1f2d45;
    --text: #e2e8f0;
    --muted: #64748b;
    --primary: #38bdf8;
    --primary-h: #0ea5e9;
    --pass: #22c55e;
    --warn: #f59e0b;
    --fail: #ef4444;
    --radius: 10px;
    --radius-sm: 6px;
    --header-h: 52px;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Header ── */
.site-header {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.header-inner {
    height: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
}

.logo-icon {
    font-size: 1.4rem;
}

.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #000;
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-h);
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
}

.btn-outline:hover:not(:disabled) {
    color: var(--text);
    border-color: var(--primary);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--muted);
}

.btn-ghost:hover {
    color: var(--text);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.76rem;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 0.72rem;
}

.btn-danger {
    background: transparent;
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--fail);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.06);
}

/* ── App Body ── */
.app-body {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

/* ── Panels ── */
.panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.panel-results {
    border-right: none;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-title {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.panel-header-actions {
    display: flex;
    gap: 4px;
}

/* ── YAML Editor ── */
.yaml-editor {
    flex: 1;
    background: var(--bg);
    color: #c9d1d9;
    border: none;
    outline: none;
    resize: none;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.7;
    padding: 16px;
    tab-size: 2;
    overflow-y: auto;
}

.yaml-editor::placeholder {
    color: var(--border);
}

.panel-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.shortcut-hint {
    font-size: 0.7rem;
    color: var(--muted);
}

/* ── Results ── */
.summary-badges {
    display: flex;
    gap: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}

.badge-pass {
    background: rgba(34, 197, 94, 0.15);
    color: var(--pass);
}

.badge-warn {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warn);
}

.badge-fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--fail);
}

.results-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.results-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    color: var(--muted);
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.3;
}

/* ── Resource Section ── */
.resource-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.resource-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface-2);
    cursor: pointer;
    user-select: none;
}

.resource-kind {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
}

.resource-name {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 600;
    flex: 1;
}

.resource-badges {
    display: flex;
    gap: 4px;
}

.resource-toggle {
    color: var(--muted);
    font-size: 0.75rem;
    margin-left: auto;
}

.resource-section.collapsed .check-list {
    display: none;
}

/* ── Check Items ── */
.check-list {
    padding: 8px 0;
}

.check-item {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    gap: 8px;
    align-items: flex-start;
    padding: 7px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.check-item:last-child {
    border-bottom: none;
}

.check-icon {
    font-size: 0.8rem;
    padding-top: 1px;
}

.check-icon-pass {
    color: var(--pass);
}

.check-icon-warn {
    color: var(--warn);
}

.check-icon-fail {
    color: var(--fail);
}

.check-icon-info {
    color: var(--muted);
}

.check-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.check-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
}

.check-detail {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.5;
}

.check-fix {
    font-size: 0.72rem;
    font-family: var(--mono);
    color: #7dd3fc;
    background: rgba(56, 189, 248, 0.06);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: 4px;
    padding: 4px 8px;
    margin-top: 4px;
    overflow-x: auto;
    white-space: pre;
}

.check-status {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 4px;
}

.check-status-pass {
    color: var(--pass);
    background: rgba(34, 197, 94, 0.1);
}

.check-status-warn {
    color: var(--warn);
    background: rgba(245, 158, 11, 0.1);
}

.check-status-fail {
    color: var(--fail);
    background: rgba(239, 68, 68, 0.1);
}

.check-status-skip {
    color: var(--muted);
    background: rgba(100, 116, 139, 0.1);
}

/* ── Drawer ── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    justify-content: flex-end;
}

.drawer-overlay[hidden] {
    display: none;
}

.drawer {
    width: 340px;
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.drawer-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
}

.saved-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.saved-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.18s;
}

.saved-item:hover {
    border-color: var(--primary);
}

.saved-item-name {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.saved-item-meta {
    font-size: 0.72rem;
    color: var(--muted);
}

.saved-item-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.saved-empty {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 40px 20px;
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 18px;
    right: 18px;
    background: var(--text);
    color: var(--bg);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 0.8rem;
    z-index: 999;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.25s ease;
    pointer-events: none;
    max-width: 280px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 760px) {
    .app-body {
        grid-template-columns: 1fr;
        grid-template-rows: 50vh 1fr;
        overflow: auto;
    }

    body {
        overflow: hidden;
    }
}