/* Shared controls and movable dialogs for the V1 workspace. */
:root {
    --aur-accent: #2563eb;
    --aur-accent-hover: #1d4ed8;
    --aur-accent-soft: #eff6ff;
    --aur-border: #e2e8f0;
    --aur-ink: #1e293b;
    --aur-muted: #64748b;
    --aur-surface: #fff;
    --aur-surface-muted: #f8fafc;
}

.btn {
    min-height: 36px;
    padding: 7px 14px;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 9px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease;
}
.btn.btn-primary { color: #fff; background: var(--aur-accent); border-color: var(--aur-accent); box-shadow: 0 2px 4px #24316e14; }
.btn.btn-primary:hover:not(:disabled) { background: var(--aur-accent-hover); border-color: var(--aur-accent-hover); box-shadow: 0 3px 8px #24316e24; }
.btn.btn-ghost { color: #526079; background: #fff; border-color: #d6deea; }
.btn.btn-ghost:hover:not(:disabled) { color: var(--aur-accent); background: #f1f4fc; border-color: #bac5e4; }
.btn.btn-danger:not(.btn-ghost) { color: #fff; background: #c34545; border-color: #c34545; }
.btn.btn-danger:not(.btn-ghost):hover:not(:disabled) { background: #ad3737; border-color: #ad3737; }
.btn.btn-danger.btn-ghost { color: #b73e3e; border-color: #efcccc; background: #fffafa; }
.btn.btn-info { color: #fff; background: #28788e; border-color: #28788e; }
.btn.btn-warning { color: #fff; background: #98670f; border-color: #98670f; }
.btn.btn-sm { min-height: 30px; padding: 5px 9px; border-radius: 7px; font-size: 12px; }
.btn:hover { opacity: 1; transform: none; }
.btn:disabled { opacity: .42; box-shadow: none; cursor: not-allowed; }
.btn:focus-visible, .dialog-close:focus-visible {
    outline: 3px solid #2563eb40;
    outline-offset: 3px;
}

/* Compact directory actions use quiet surfaces, with red reserved for delete. */
.cat-actions .btn.btn-info {
    color: var(--aur-accent-hover);
    background: var(--aur-accent-soft);
    border-color: #bfdbfe;
    box-shadow: none;
}
.cat-actions .btn.btn-warning {
    color: #475569;
    background: var(--aur-surface-muted);
    border-color: #cbd5e1;
    box-shadow: none;
}
.cat-actions .btn.btn-danger {
    color: #b91c1c;
    background: #fff1f2;
    border-color: #fecdd3;
    box-shadow: none;
}
.cat-actions .btn.btn-info:hover:not(:disabled) {
    color: #1e40af;
    background: #dbeafe;
    border-color: #93c5fd;
}
.cat-actions .btn.btn-warning:hover:not(:disabled) {
    color: var(--aur-ink);
    background: #e2e8f0;
    border-color: #94a3b8;
}
.cat-actions .btn.btn-danger:hover:not(:disabled) {
    color: #991b1b;
    background: #ffe4e6;
    border-color: #fda4af;
}

.modal-overlay {
    background: #15223d66;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    overscroll-behavior: contain;
}
.modal-overlay > .aur-dialog {
    --dialog-x: 0px;
    --dialog-y: 0px;
    translate: var(--dialog-x) var(--dialog-y);
    max-width: min(var(--dialog-width, 100vw), calc(100vw - 24px)) !important;
    max-height: calc(100dvh - 32px) !important;
    border: 1px solid #e1e6ef;
    border-radius: 16px;
    color: var(--aur-ink);
    background: #fff;
    box-shadow: 0 24px 80px #15223d30, 0 4px 16px #15223d14;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #c8d0df transparent;
}
.aur-dialog .dialog-titlebar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 66px;
    margin: 0 !important;
    padding: 17px 22px !important;
    border-bottom: 1px solid #e5eaf2 !important;
    color: var(--aur-ink) !important;
    background: linear-gradient(180deg, #fcfdff, #f6f8fc) !important;
    border-radius: 15px 15px 0 0;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.aur-dialog.dialog-padded > .dialog-titlebar {
    margin: calc(-1 * var(--dialog-inset)) calc(-1 * var(--dialog-inset)) 20px !important;
}
.aur-dialog .dialog-titlebar > :first-child { min-width: 0; }
.aur-dialog .dialog-titlebar h3 {
    margin: 0 !important;
    color: var(--aur-ink) !important;
    font-size: 17px !important;
    line-height: 1.45;
    font-weight: 650;
    letter-spacing: .1px;
    overflow-wrap: anywhere;
}
.aur-dialog .dialog-titlebar p { color: var(--aur-muted); font-size: 12px; line-height: 1.6; }
.aur-dialog .dialog-titlebar:focus-visible { outline: 2px solid #8796dc; outline-offset: -4px; }
.aur-dialog.dialog-dragging { box-shadow: 0 30px 90px #15223d3d, 0 6px 20px #15223d20; }
.aur-dialog.dialog-dragging .dialog-titlebar { cursor: grabbing; }
.aur-dialog .dialog-close {
    position: static !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid #dfe5ee !important;
    border-radius: 10px !important;
    color: #64738b !important;
    background: #fff !important;
    font-family: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transform: none !important;
    box-shadow: 0 1px 2px #15223d05 !important;
    transition: color .16s, background-color .16s, border-color .16s;
}
.aur-dialog .dialog-close .icon { width: 17px; height: 17px; font-size: 17px; }
.aur-dialog .dialog-close:hover:not(:disabled) { color: #b73e3e !important; background: #fff3f3 !important; border-color: #edcaca !important; }
.aur-dialog .modal-actions { gap: 10px; flex-wrap: wrap; border-top: 1px solid #e8ecf3; padding-top: 18px; }
.aur-dialog .modal-actions .btn { min-width: 78px; }
.aur-dialog .modal-footer { padding: 16px 22px; border-top: 1px solid #e8ecf3; background: #fafbfd; }
.aur-dialog.log-detail-card { width: 600px; }
.aur-dialog.log-detail-card > .modal-body { padding: 20px 22px; }
.aur-dialog.log-detail-card > .modal-actions { margin: 0; padding: 16px 22px; }
.aur-dialog.modal-card > .modal-body { min-height: 0; overflow: auto; }
.aur-dialog :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea) {
    border-color: #d6deea;
    border-radius: 8px;
    color: var(--aur-ink);
    transition: border-color .16s, box-shadow .16s;
}
.aur-dialog :is(input, select, textarea):focus-visible { outline: 2px solid #5263c780; outline-offset: 2px; }
.aur-dialog :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--aur-accent); }
.aur-dialog .naming-tips { line-height: 1.65; }
.aur-dialog .audio-variant-option { border-color: #dfe6f0; background: #f7f9fd; }

@media (max-width: 640px) {
    .modal-overlay > .aur-dialog { max-height: calc(100dvh - 24px) !important; border-radius: 13px; }
    .aur-dialog .dialog-titlebar { padding: 14px 16px !important; min-height: 62px; gap: 10px; border-radius: 12px 12px 0 0; }
    .aur-dialog .dialog-titlebar h3 { font-size: 16px !important; }
    #cosConfigModal .modal-body { padding: 0 0 16px !important; }
    #systemSettingsModal .settings-layout > div:first-child { flex-shrink: 0; padding: 8px !important; }
    #systemSettingsModal .settings-layout > div:first-child > div:first-child { display: none; }
    #systemSettingsModal .settings-layout > div:last-child { padding: 18px 12px !important; }
    #systemSettingsModal .settings-nav-item { flex-shrink: 0; }
    .aur-dialog .modal-actions { gap: 8px; }
    .aur-dialog .modal-actions .btn { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
    .btn, .aur-dialog, .dialog-close { transition: none !important; }
}
