/* retoor <retoor@molodetz.nl> */

.dialog-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-dark);
    z-index: var(--z-chrome-dialog);
    align-items: center;
    justify-content: center;
}

.dialog-overlay.visible {
    display: flex;
}

.dialog-card {
    width: 100%;
    max-width: 460px;
    margin: 1rem;
}

.dialog-message {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.dialog-links {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-md);
    margin: 0 0 1rem;
    padding: 0;
    font-size: 0.875rem;
}

.dialog-links a {
    color: var(--accent);
}

.dialog-field {
    margin-bottom: 1rem;
}

.dialog-field-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.dialog-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
}

.dialog-input:focus {
    outline: none;
    border-color: var(--accent);
}

.dialog-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.dialog-danger:hover {
    background: var(--danger);
    filter: brightness(1.1);
}

.context-menu {
    display: none;
    position: fixed;
    z-index: var(--z-chrome-menu);
    min-width: 180px;
    max-width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.25rem;
    overflow: hidden;
}

.context-menu.visible {
    display: block;
}

.context-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.context-menu-sep {
    height: 1px;
    margin: 0.25rem 0.5rem;
    background: var(--border);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: none;
    background: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
}

.context-menu-item:hover {
    background: var(--bg-card-hover);
}

.context-menu-item:disabled {
    color: var(--text-muted);
    cursor: default;
    background: none;
}

.context-menu-item.danger {
    color: var(--danger);
}

.context-menu-icon {
    width: 1.25rem;
    text-align: center;
}

dp-content {
    display: block;
}

dp-title {
    display: inline;
}

dp-upload {
    display: block;
}

dp-upload[hidden] {
    display: none;
}

.dp-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dp-upload-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.dp-upload-btn.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.dp-upload-btn.uploading {
    opacity: 0.6;
    pointer-events: none;
}

.dp-upload-icon {
    font-size: 1rem;
    line-height: 1;
}

.dp-upload-count {
    color: var(--accent);
    font-weight: 600;
}

.dp-upload-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.dp-upload-chips:empty {
    margin-top: 0;
}

.dp-upload-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    max-width: 16rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.dp-upload-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dp-upload-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

.dp-upload-chip-remove:hover {
    color: var(--danger);
    background: var(--bg-card-hover);
}

.dp-upload-error {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: var(--danger);
}

.dp-upload-error:empty {
    margin-top: 0;
}

.dp-toast-host {
    position: fixed;
    bottom: max(1rem, env(safe-area-inset-bottom));
    right: max(1rem, env(safe-area-inset-right));
    z-index: var(--z-chrome-toast);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.dp-toast {
    min-width: 12rem;
    max-width: min(22rem, calc(100vw - 2rem));
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 0.875rem;
    opacity: 0;
    transform: translateY(0.5rem);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.dp-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.dp-toast-link {
    cursor: pointer;
}

.dp-toast-success {
    border-color: var(--success);
}

.dp-toast-error {
    border-color: var(--danger);
}

emoji-picker {
    color-scheme: dark;
    --background: var(--bg-modal);
    --border-color: var(--border);
    --border-radius: var(--radius);
    --button-active-background: var(--bg-card-hover);
    --button-hover-background: var(--bg-card-hover);
    --category-font-color: var(--text-secondary);
    --indicator-color: var(--accent);
    --input-border-color: var(--border);
    --input-font-color: var(--text-primary);
    --input-placeholder-color: var(--text-muted);
    --outline-color: var(--accent);
}
