/* ==========================================================================
   EncodeCore Canonical Design System for EncodePlan
   Source: .gemini/skills/design-system/SKILL.md
   ========================================================================== */

:root {
    /* Brand & Primary Palette (Indigo) */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;
    --primary: var(--primary-600);
    --accent-color: var(--primary-600);

    /* Neutral Backgrounds & Glass Surfaces */
    --bg-app: #f8fafc;
    --bg-surface: rgba(255, 255, 255, 0.96);
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-subtle: rgba(255, 255, 255, 0.70);
    --border-subtle: rgba(226, 232, 240, 0.85);
    --border-strong: #cbd5e1;
    --border-color: #e2e8f0;

    /* Typography & Content Colors */
    --text-primary: #0f172a;
    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Semantic Status Palette */
    --status-success-bg: #ecfdf5;
    --status-success-text: #065f46;
    --status-success-border: #a7f3d0;

    --status-warning-bg: #fffbeb;
    --status-warning-text: #92400e;
    --status-warning-border: #fde68a;

    --status-danger-bg: #fef2f2;
    --status-danger-text: #991b1b;
    --status-danger-border: #fecaca;

    --status-info-bg: #f0f9ff;
    --status-info-text: #0369a1;
    --status-info-border: #bae6fd;

    --status-neutral-bg: #f1f5f9;
    --status-neutral-text: #475569;
    --status-neutral-border: #cbd5e1;

    /* Elevation & Soft Shadows */
    --shadow-soft-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-soft-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-soft-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);

    /* Radii Geometry */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

/* ==========================================================================
   Base Resets & Global Application Layout
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ==========================================================================
   2. Layout Containers: Glassmorphism & Soft UI
   ========================================================================== */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    box-shadow: var(--shadow-soft-md);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.glass-panel:hover {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: var(--shadow-soft-lg);
}

.sticky-actions-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.75rem 0;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

/* ==========================================================================
   3. Stepper: Protocol Lifecycle Progress
   ========================================================================== */
.lifecycle-stepper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
    width: fit-content;
}

.stepper-step {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.stepper-step.completed {
    color: var(--status-success-text);
}

.stepper-step.active {
    color: var(--primary);
    font-weight: 700;
}

.stepper-step-indicator {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    background: var(--status-neutral-bg);
    color: var(--status-neutral-text);
}

.stepper-step.completed .stepper-step-indicator {
    background: var(--status-success-bg);
    color: var(--status-success-text);
    border: 1px solid var(--status-success-border);
}

.stepper-step.active .stepper-step-indicator {
    background: var(--primary-50);
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.stepper-divider {
    color: var(--border-strong);
    font-size: 0.75rem;
    margin: 0 0.25rem;
}

/* ==========================================================================
   4. Progressive Disclosure: Collapsible Accordion
   ========================================================================== */
.collapsible-section {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-md);
    margin-top: 1.25rem;
    transition: all 0.2s ease-in-out;
    background: rgba(0, 0, 0, 0.005);
}

.collapsible-summary {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-radius: 9px;
    transition: all 0.2s ease-in-out;
}

.collapsible-summary::-webkit-details-marker,
.collapsible-summary::marker {
    display: none;
}

.collapsible-summary:hover {
    background: rgba(0, 0, 0, 0.02);
    color: var(--primary);
}

.collapsible-section[open] {
    border-color: rgba(99, 102, 241, 0.35);
    background: white;
}

.collapsible-section[open] > .collapsible-summary {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.collapsible-content {
    padding: 1.25rem 1.5rem;
}

/* ==========================================================================
   5. Semantic Tags & Badges
   ========================================================================== */
.tag-badge,
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    border: 1px solid transparent;
}

.badge-success {
    background: var(--status-success-bg);
    color: var(--status-success-text);
    border-color: var(--status-success-border);
}

.badge-warning {
    background: var(--status-warning-bg);
    color: var(--status-warning-text);
    border-color: var(--status-warning-border);
}

.badge-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger-text);
    border-color: var(--status-danger-border);
}

.badge-info {
    background: var(--status-info-bg);
    color: var(--status-info-text);
    border-color: var(--status-info-border);
}

.badge-primary {
    background: var(--primary-50);
    color: var(--primary-700);
    border-color: var(--primary-200);
}

.badge-neutral {
    background: var(--status-neutral-bg);
    color: var(--status-neutral-text);
    border-color: var(--status-neutral-border);
}

/* ==========================================================================
   6. Modern Card-Based Data Tables
   ========================================================================== */
.table-container-modern {
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft-sm);
    overflow: hidden;
}

.data-table-modern {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.data-table-modern thead {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

.data-table-modern th {
    padding: 0.85rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.data-table-modern td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table-modern tbody tr {
    transition: background-color 0.15s ease;
}

.data-table-modern tbody tr:hover {
    background-color: #f8fafc;
}

.data-table-modern tbody tr:last-child td {
    border-bottom: none;
}

/* ==========================================================================
   7. Metric Cards (KPI Telemetry)
   ========================================================================== */
.metric-card {
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-soft-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft-lg);
    border-color: rgba(99, 102, 241, 0.3);
}

.metric-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.metric-card-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.metric-card-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.metric-card-footer {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   8. Buttons & Form Controls
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
    line-height: 1.25;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary-700);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-700);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background-color: white;
    color: var(--text-secondary);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background-color: #f8fafc;
    color: var(--primary);
    border-color: var(--primary-300);
}

.btn-danger {
    background-color: #fee2e2;
    color: var(--status-danger-text);
    border-color: #fca5a5;
}

.btn-danger:hover {
    background-color: #fecaca;
    color: #7f1d1d;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.form-input-modern,
.form-select-modern,
.form-textarea-modern {
    width: 100%;
    padding: 0.65rem 0.95rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input-modern:focus,
.form-select-modern:focus,
.form-textarea-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

/* ==========================================================================
   9. Alerts & Flash Banners
   ========================================================================== */
.alert-modern {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: var(--shadow-soft-sm);
}

.alert-success {
    background: var(--status-success-bg);
    color: var(--status-success-text);
    border: 1px solid var(--status-success-border);
    border-left: 4px solid #10b981;
}

.alert-warning {
    background: var(--status-warning-bg);
    color: var(--status-warning-text);
    border: 1px solid var(--status-warning-border);
    border-left: 4px solid #f59e0b;
}

.alert-danger,
.alert-error {
    background: var(--status-danger-bg);
    color: var(--status-danger-text);
    border: 1px solid var(--status-danger-border);
    border-left: 4px solid #ef4444;
}

.alert-info {
    background: var(--status-info-bg);
    color: var(--status-info-text);
    border: 1px solid var(--status-info-border);
    border-left: 4px solid #0284c7;
}

/* ==========================================================================
   10. Lucide Vector Iconography Helpers
   ========================================================================== */
.lucide,
[data-lucide] {
    display: inline-block;
    vertical-align: -0.15em;
    width: 1.15rem;
    height: 1.15rem;
    stroke-width: 1.85;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
}

.lucide-sm,
[data-lucide].lucide-sm {
    width: 0.92rem;
    height: 0.92rem;
    stroke-width: 2;
}

.lucide-lg,
[data-lucide].lucide-lg {
    width: 1.5rem;
    height: 1.5rem;
    stroke-width: 1.75;
}

.lucide-xl,
[data-lucide].lucide-xl {
    width: 2rem;
    height: 2rem;
    stroke-width: 1.75;
}
