/* Edge Functions Panel - matches Supabase Studio dark theme */

#ef-panel-wrapper {
    background: hsl(var(--background-default, 200 10% 10%));
    color: hsl(var(--foreground-default, 0 0% 95%));
    padding: 24px 32px;
    flex: 1;
    overflow-y: auto;
    font-family: var(--font-custom, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

/* Header */
.ef-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid hsl(var(--border-default, 200 10% 20%));
}
.ef-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ef-header-left svg { color: hsl(var(--foreground-muted, 0 0% 65%)); }
.ef-header h1 {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    color: hsl(var(--foreground-default, 0 0% 95%));
}
.ef-project-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 9999px;
    background: hsl(var(--brand-default, 153 60% 53%) / 0.15);
    color: hsl(var(--brand-default, 153 60% 53%));
    font-weight: 500;
}
.ef-docs-link {
    font-size: 13px;
    color: hsl(var(--foreground-muted, 0 0% 65%));
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid hsl(var(--border-default, 200 10% 22%));
    border-radius: 6px;
    transition: all 0.15s;
}
.ef-docs-link:hover {
    color: hsl(var(--foreground-default, 0 0% 95%));
    border-color: hsl(var(--border-default, 200 10% 30%));
}

/* New Function button */
.ef-new-btn {
    font-size: 13px;
    color: hsl(153 60% 10%);
    background: hsl(var(--brand-default, 153 60% 53%));
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}
.ef-new-btn:hover {
    filter: brightness(1.1);
}
.ef-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Loading */
.ef-loading {
    text-align: center;
    padding: 60px 20px;
    color: hsl(var(--foreground-muted, 0 0% 55%));
    font-size: 14px;
}

/* Empty state */
.ef-empty {
    text-align: center;
    padding: 80px 20px;
    color: hsl(var(--foreground-muted, 0 0% 55%));
}
.ef-empty svg { margin: 0 auto 16px; opacity: 0.4; }
.ef-empty h3 {
    font-size: 16px;
    font-weight: 500;
    color: hsl(var(--foreground-default, 0 0% 85%));
    margin: 0 0 8px;
}
.ef-empty p { font-size: 13px; margin: 4px 0; }
.ef-hint { margin-top: 16px !important; }
.ef-hint code {
    background: hsl(var(--background-surface, 200 10% 14%));
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}

/* Table */
.ef-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ef-table thead th {
    text-align: left;
    padding: 10px 16px;
    font-weight: 500;
    font-size: 12px;
    color: hsl(var(--foreground-muted, 0 0% 55%));
    border-bottom: 1px solid hsl(var(--border-default, 200 10% 20%));
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ef-row {
    cursor: pointer;
    transition: background 0.1s;
}
.ef-row:hover { background: hsl(var(--background-surface, 200 10% 14%)); }
.ef-row td {
    padding: 12px 16px;
    border-bottom: 1px solid hsl(var(--border-default, 200 10% 15%));
    vertical-align: middle;
}
.ef-name {
    font-weight: 500;
    color: hsl(var(--foreground-default, 0 0% 95%));
    white-space: nowrap;
}
.ef-url {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ef-url code {
    font-size: 12px;
    color: hsl(var(--foreground-muted, 0 0% 65%));
    font-family: var(--font-source-code-pro, 'Source Code Pro', monospace);
    max-width: 32rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ef-copy {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: hsl(var(--foreground-muted, 0 0% 45%));
    transition: color 0.15s;
    flex-shrink: 0;
}
.ef-copy:hover { color: hsl(var(--foreground-default, 0 0% 85%)); }

/* Detail view */
.ef-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.ef-back {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid hsl(var(--border-default, 200 10% 22%));
    border-radius: 6px;
    color: hsl(var(--foreground-muted, 0 0% 65%));
    cursor: pointer;
    padding: 4px 10px;
    font-size: 13px;
    transition: all 0.15s;
}
.ef-back:hover {
    color: hsl(var(--foreground-default, 0 0% 95%));
    border-color: hsl(var(--border-default, 200 10% 35%));
}
.ef-detail h2 {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
}
.ef-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: hsl(var(--background-surface, 200 10% 12%));
    border: 1px solid hsl(var(--border-default, 200 10% 18%));
    border-radius: 8px;
}
.ef-meta-item { display: flex; flex-direction: column; gap: 2px; }
.ef-meta-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: hsl(var(--foreground-muted, 0 0% 50%));
}
.ef-meta-value {
    font-size: 13px;
    color: hsl(var(--foreground-default, 0 0% 85%));
}
.ef-path {
    font-family: var(--font-source-code-pro, monospace);
    font-size: 12px;
    word-break: break-all;
}
/* Code toolbar */
.ef-code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.ef-code-header {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: hsl(var(--foreground-muted, 0 0% 50%));
}
.ef-code-actions {
    display: flex;
    gap: 6px;
}
.ef-edit-btn, .ef-delete-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid hsl(var(--border-default, 200 10% 25%));
    border-radius: 6px;
    background: none;
    color: hsl(var(--foreground-muted, 0 0% 70%));
    cursor: pointer;
    transition: all 0.15s;
}
.ef-edit-btn:hover {
    color: hsl(var(--brand-default, 153 60% 53%));
    border-color: hsl(var(--brand-default, 153 60% 53%) / 0.5);
}
.ef-delete-btn:hover {
    color: hsl(0 80% 65%);
    border-color: hsl(0 80% 65% / 0.5);
}

/* Editor */
.ef-editor-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ef-editor {
    width: 100%;
    min-height: 400px;
    max-height: 70vh;
    box-sizing: border-box;
    background: hsl(var(--background-surface, 200 10% 8%));
    border: 2px solid hsl(var(--brand-default, 153 60% 53%) / 0.4);
    border-radius: 8px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.5;
    font-family: var(--font-source-code-pro, 'Source Code Pro', monospace);
    color: hsl(var(--foreground-default, 0 0% 90%));
    tab-size: 2;
    resize: vertical;
    outline: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}
.ef-editor:focus {
    border-color: hsl(var(--brand-default, 153 60% 53%));
    box-shadow: 0 0 0 2px hsl(var(--brand-default, 153 60% 53%) / 0.15);
}
.ef-editor-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ef-editor-status {
    font-size: 12px;
    color: hsl(var(--foreground-muted, 0 0% 55%));
}
.ef-status-error {
    color: hsl(0 80% 70%) !important;
}
.ef-editor-hint {
    font-size: 11px;
    color: hsl(var(--foreground-muted, 0 0% 40%));
    margin-right: auto;
}
.ef-cancel-btn {
    font-size: 13px;
    padding: 6px 16px;
    border: 1px solid hsl(var(--border-default, 200 10% 25%));
    border-radius: 6px;
    background: none;
    color: hsl(var(--foreground-muted, 0 0% 70%));
    cursor: pointer;
    transition: all 0.15s;
}
.ef-cancel-btn:hover {
    color: hsl(var(--foreground-default, 0 0% 95%));
    border-color: hsl(var(--border-default, 200 10% 35%));
}
.ef-save-btn {
    font-size: 13px;
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    background: hsl(var(--brand-default, 153 60% 53%));
    color: hsl(153 60% 10%);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}
.ef-save-btn:hover { filter: brightness(1.1); }
.ef-save-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.ef-code {
    background: hsl(var(--background-surface, 200 10% 8%));
    border: 1px solid hsl(var(--border-default, 200 10% 18%));
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    font-family: var(--font-source-code-pro, 'Source Code Pro', monospace);
    color: hsl(var(--foreground-default, 0 0% 80%));
    max-height: 600px;
    overflow-y: auto;
    tab-size: 2;
    white-space: pre;
    margin: 0;
}
.ef-code code { font-family: inherit; }

@media (max-width: 768px) {
    .ef-hide-sm { display: none; }
    #ef-panel-wrapper { padding: 16px; }
}
