/* ═══════════════════════════════════════════════════════════════════
   Mission Control V4 — Skills Registry Styles
   Amber/Gold Theme (#e8a830) on Charcoal (#0f0f0f)
   ═══════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────────────
   CSS CUSTOM PROPERTIES (Theme Variables)
   ────────────────────────────────────────────────────────────────────── */
:root {
    /* Primary Colors */
    --color-primary: #e8a830;
    --color-primary-light: #f0b840;
    --color-primary-dark: #c89020;
    --color-primary-dim: rgba(232, 168, 48, 0.15);

    /* Background Colors */
    --color-bg: #0f0f0f;
    --color-bg-elevated: #1a1a1a;
    --color-bg-card: #141414;
    --color-bg-hover: #1f1f1f;
    --color-bg-active: #252525;

    /* Text Colors */
    --color-text-primary: #ffffff;
    --color-text-secondary: #b0b0b0;
    --color-text-muted: #808080;
    --color-text-dim: #606060;

    /* Status Colors */
    --color-success: #22c55e;
    --color-success-dim: rgba(34, 197, 94, 0.15);
    --color-warning: #f59e0b;
    --color-warning-dim: rgba(245, 158, 11, 0.15);
    --color-danger: #ef4444;
    --color-danger-dim: rgba(239, 68, 68, 0.15);
    --color-info: #3b82f6;
    --color-info-dim: rgba(59, 130, 246, 0.15);

    /* Agent Colors */
    --color-atlas: #8b5cf6;
    --color-atlas-dim: rgba(139, 92, 246, 0.15);
    --color-cody: #06b6d4;
    --color-cody-dim: rgba(6, 182, 212, 0.15);
    --color-both: #e8a830;
    --color-both-dim: rgba(232, 168, 48, 0.15);

    /* Border Colors */
    --color-border: #333333;
    --color-border-light: #404040;
    --color-border-focus: var(--color-primary);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;

    /* Typography */
    --font-header: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 12px rgba(232, 168, 48, 0.3);
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;
}

/* ──────────────────────────────────────────────────────────────────────
   GLOBAL STYLES & RESET
   ────────────────────────────────────────────────────────────────────── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.theme-dark {
    color-scheme: dark;
}

button {
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
}

select, input {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* ──────────────────────────────────────────────────────────────────────
   SKILLS REGISTRY CONTAINER
   ────────────────────────────────────────────────────────────────────── */
.skills-registry {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ──────────────────────────────────────────────────────────────────────
   HEADER
   ────────────────────────────────────────────────────────────────────── */
.sr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xl) var(--space-2xl);
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(180deg, var(--color-bg-elevated) 0%, var(--color-bg) 100%);
}

.sr-header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.sr-title {
    font-family: var(--font-header);
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--color-text-primary);
}

.sr-title-icon {
    font-size: 28px;
}

.sr-subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
}

.sr-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.sr-status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 12px;
}

.sr-status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--color-warning);
    animation: sr-pulse 2s infinite;
}

.sr-status-dot.sr-status-connected {
    background: var(--color-success);
    animation: none;
}

.sr-status-dot.sr-status-error {
    background: var(--color-danger);
    animation: none;
}

@keyframes sr-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sr-status-text {
    color: var(--color-text-secondary);
}

.sr-refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.sr-refresh-btn:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.sr-refresh-btn:active {
    transform: scale(0.95);
}

/* ──────────────────────────────────────────────────────────────────────
   STATS BAR
   ────────────────────────────────────────────────────────────────────── */
.sr-stats-bar {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    padding: var(--space-lg) var(--space-2xl);
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.sr-stat-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.sr-stat-value {
    font-family: var(--font-header);
    font-size: 20px;
    font-weight: 600;
    color: var(--color-primary);
}

.sr-stat-label {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ──────────────────────────────────────────────────────────────────────
   CONTROLS BAR
   ────────────────────────────────────────────────────────────────────── */
.sr-controls {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg) var(--space-2xl);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.sr-filter-group,
.sr-sort-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sr-filter-label,
.sr-sort-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.sr-filter-select,
.sr-sort-select {
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sr-filter-select:hover,
.sr-sort-select:hover {
    border-color: var(--color-border-light);
}

.sr-filter-select:focus,
.sr-sort-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-dim);
}

.sr-search-group {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.sr-search-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md) var(--space-sm) 36px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 13px;
    transition: all var(--transition-fast);
}

.sr-search-input::placeholder {
    color: var(--color-text-dim);
}

.sr-search-input:hover {
    border-color: var(--color-border-light);
}

.sr-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-dim);
}

.sr-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

/* ──────────────────────────────────────────────────────────────────────
   MAIN CONTENT
   ────────────────────────────────────────────────────────────────────── */
.sr-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sr-skills-section {
    flex: 1;
    padding: var(--space-xl) var(--space-2xl);
}

.sr-skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

/* ──────────────────────────────────────────────────────────────────────
   SKILL CARD
   ────────────────────────────────────────────────────────────────────── */
.sr-skill-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.sr-skill-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--color-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.sr-skill-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transform: translateY(-2px);
}

.sr-skill-card:hover::before {
    opacity: 1;
}

.sr-skill-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.sr-skill-name {
    font-family: var(--font-header);
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.3;
}

.sr-skill-badges {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.sr-skill-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sr-skill-badge-agent {
    background: var(--color-atlas-dim);
    color: var(--color-atlas);
}

.sr-skill-badge-agent.atlas {
    background: var(--color-atlas-dim);
    color: var(--color-atlas);
}

.sr-skill-badge-agent.cody {
    background: var(--color-cody-dim);
    color: var(--color-cody);
}

.sr-skill-badge-agent.both {
    background: var(--color-both-dim);
    color: var(--color-both);
}

.sr-skill-badge-type {
    background: var(--color-primary-dim);
    color: var(--color-primary);
}

.sr-skill-body {
    margin-bottom: var(--space-md);
}

.sr-skill-description {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sr-skill-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--color-text-muted);
}

.sr-skill-category {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.sr-skill-category::before {
    content: '📁';
    font-size: 12px;
}

.sr-skill-last-used {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.sr-skill-last-used::before {
    content: '🕐';
    font-size: 12px;
}

/* ──────────────────────────────────────────────────────────────────────
   LOADING & EMPTY STATES
   ────────────────────────────────────────────────────────────────────── */
.sr-loading-state,
.sr-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--color-text-muted);
    text-align: center;
}

.sr-loading-state::before,
.sr-empty-state::before {
    content: '';
    font-size: 48px;
    margin-bottom: var(--space-md);
}

.sr-loading-state::before {
    content: '⏳';
}

.sr-empty-state::before {
    content: '🔍';
}

/* ──────────────────────────────────────────────────────────────────────
   DETAIL PANEL
   ────────────────────────────────────────────────────────────────────── */
.sr-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 1000;
}

.sr-detail-overlay.sr-detail-open {
    opacity: 1;
    visibility: visible;
}

.sr-detail-panel {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    max-width: 90vw;
    height: 100vh;
    background: var(--color-bg-elevated);
    border-left: 1px solid var(--color-border);
    transition: right var(--transition-normal);
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.sr-detail-panel.sr-detail-open {
    right: 0;
}

.sr-detail-close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
    z-index: 10;
}

.sr-detail-close:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.sr-detail-content {
    flex: 1;
    padding: var(--space-2xl);
    overflow-y: auto;
}

/* Detail Content Styles */
.sr-detail-header {
    margin-bottom: var(--space-xl);
}

.sr-detail-title {
    font-family: var(--font-header);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-md);
}

.sr-detail-badges {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.sr-detail-section {
    margin-bottom: var(--space-xl);
}

.sr-detail-section-title {
    font-family: var(--font-header);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sr-detail-description {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.sr-detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.sr-detail-meta-item {
    padding: var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.sr-detail-meta-label {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.sr-detail-meta-value {
    font-size: 14px;
    color: var(--color-text-primary);
}

.sr-detail-parameters {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.sr-detail-parameter {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.sr-detail-parameter:last-child {
    border-bottom: none;
}

.sr-detail-parameter-name {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text-primary);
}

.sr-detail-parameter-type {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-primary);
}

.sr-detail-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.sr-detail-action-btn {
    flex: 1;
    padding: var(--space-md);
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-bg);
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.sr-detail-action-btn:hover {
    background: var(--color-primary-light);
}

.sr-detail-action-btn.secondary {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.sr-detail-action-btn.secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ──────────────────────────────────────────────────────────────────────
   RESPONSIVE DESIGN
   ────────────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .sr-controls {
        gap: var(--space-md);
    }
}

@media (max-width: 768px) {
    .sr-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .sr-stats-bar {
        gap: var(--space-lg);
    }

    .sr-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .sr-filter-group,
    .sr-sort-group {
        width: 100%;
    }

    .sr-filter-select,
    .sr-sort-select {
        flex: 1;
    }

    .sr-search-group {
        max-width: none;
    }

    .sr-skills-grid {
        grid-template-columns: 1fr;
    }

    .sr-detail-panel {
        width: 100%;
        max-width: none;
    }

    .sr-detail-meta-grid {
        grid-template-columns: 1fr;
    }
}

/* ──────────────────────────────────────────────────────────────────────
   ANIMATIONS
   ────────────────────────────────────────────────────────────────────── */
@keyframes sr-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sr-skill-card {
    animation: sr-fadeIn var(--transition-normal) ease-out;
}

/* Stagger animations for cards */
.sr-skill-card:nth-child(1) { animation-delay: 0ms; }
.sr-skill-card:nth-child(2) { animation-delay: 50ms; }
.sr-skill-card:nth-child(3) { animation-delay: 100ms; }
.sr-skill-card:nth-child(4) { animation-delay: 150ms; }
.sr-skill-card:nth-child(5) { animation-delay: 200ms; }
.sr-skill-card:nth-child(6) { animation-delay: 250ms; }
.sr-skill-card:nth-child(7) { animation-delay: 300ms; }
.sr-skill-card:nth-child(8) { animation-delay: 350ms; }
.sr-skill-card:nth-child(9) { animation-delay: 400ms; }
.sr-skill-card:nth-child(10) { animation-delay: 450ms; }