/* --------------------------------------------------------------------------
   Glass Card Component (Refined)
   -------------------------------------------------------------------------- */
.glass-card {
    background: var(--hh-dark-surface);
    border: 1px solid var(--hh-glass-border);
    border-radius: var(--hh-radius-card);
    padding: 1rem;
    transition: border-color var(--hh-transition-normal), box-shadow var(--hh-transition-normal);
    box-shadow: var(--hh-shadow-sm);
}

@media (hover: hover) {
    .glass-card:hover {
        border-color: var(--hh-glass-border-highlight);
        box-shadow: var(--hh-shadow-md);
    }
}

.glass-card-elevated {
    background: var(--hh-dark-elevated);
    box-shadow: var(--hh-shadow-md);
    border: 1px solid var(--hh-glass-border);
    border-radius: var(--hh-radius-card);
    padding: 1rem;
}

/* --------------------------------------------------------------------------
   Surface Card (solid, no glass effect)
   -------------------------------------------------------------------------- */
.surface-card {
    background: var(--hh-dark-surface);
    border: 1px solid var(--hh-glass-border);
    border-radius: var(--hh-radius-card);
    padding: 1rem;
    transition: border-color var(--hh-transition-normal), box-shadow var(--hh-transition-normal);
    box-shadow: var(--hh-shadow-sm);
}

@media (hover: hover) {
    .surface-card:hover {
        border-color: var(--hh-glass-border-highlight);
        box-shadow: var(--hh-shadow-md);
    }
}

/* Desktop card & form scaling */
@media (min-width: 769px) {
    .glass-card,
    .glass-card-elevated,
    .surface-card {
        padding: var(--hh-spacing-xl);
    }

    .hh-radio-group,
    .hh-checkbox-group {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 1rem;
    }

    .hh-radio-option,
    .hh-checkbox-option {
        padding: 0.9rem 1rem;
        font-size: inherit;
    }
}

/* --------------------------------------------------------------------------
   Gradient Background
   -------------------------------------------------------------------------- */
.gradient-bg {
    background: var(--hh-gradient-primary);
}

.gradient-bg-animated {
    background: var(--hh-dark);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--hh-spacing-sm);
    padding: var(--hh-spacing-md) var(--hh-spacing-xl);
    background: var(--hh-action-primary-bg);
    color: var(--hh-action-primary-fg);
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: var(--hh-font-family);
    font-size: var(--hh-font-size-md);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--hh-transition-normal), box-shadow var(--hh-transition-normal), transform var(--hh-transition-normal);
    box-shadow: var(--hh-shadow-sm);
}

@media (hover: hover) {
    .btn-primary:hover {
        background: var(--hh-action-primary-bg-hover);
        box-shadow: var(--hh-shadow-md);
        transform: translateY(-1px);
    }
}

.mud-button-filled-primary {
    background-color: var(--hh-action-primary-bg) !important;
    color: var(--hh-action-primary-fg) !important;
}

@media (hover: hover) {
    .mud-button-filled-primary:hover:not(:disabled) {
        background-color: var(--hh-action-primary-bg-hover) !important;
    }
}

.btn-primary:disabled,
.btn-primary[aria-disabled="true"],
.mud-button-filled-primary:disabled,
.mud-button-filled-primary[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--hh-spacing-sm);
    padding: var(--hh-spacing-md) var(--hh-spacing-xl);
    background: transparent;
    color: var(--hh-button-secondary-text);
    border: 1px solid var(--hh-glass-border-highlight);
    border-radius: 8px;
    font-family: var(--hh-font-family);
    font-size: var(--hh-font-size-md);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--hh-transition-normal), border-color var(--hh-transition-normal), color var(--hh-transition-normal);
}

@media (hover: hover) {
    .btn-secondary:hover {
        background: var(--hh-surface-soft-hover);
        border-color: var(--hh-primary);
    }
}

/* --------------------------------------------------------------------------
   Form Inputs
   -------------------------------------------------------------------------- */
.input-modern {
    width: 100%;
    padding: var(--hh-spacing-md) var(--hh-spacing-lg);
    background: var(--hh-input-bg);
    border: 1px solid var(--hh-glass-border);
    border-radius: var(--hh-radius-md);
    color: var(--hh-text-primary);
    font-family: var(--hh-font-family);
    font-size: var(--hh-font-size-md);
    transition: background var(--hh-transition-fast), color var(--hh-transition-fast), border-color var(--hh-transition-fast), transform var(--hh-transition-fast);
}

.input-modern::placeholder {
    color: var(--hh-text-muted);
}

.input-modern:focus {
    outline: none;
    border-color: var(--hh-primary);
    background: var(--hh-input-bg-focus);
    box-shadow: 0 0 0 3px rgba(var(--hh-primary-rgb), 0.1);
}

/* --------------------------------------------------------------------------
   Shared Form Field Shells (Profile, Voice, Settings feedback, etc.)
   -------------------------------------------------------------------------- */
.hh-form-group {
    margin-bottom: 1.5rem;
}

.hh-form-group label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--hh-text-primary);
}

.hh-form-group input[type="text"],
.hh-form-group input[type="date"],
.hh-form-group input[type="number"],
.hh-form-group select,
.hh-form-group textarea {
    width: 100%;
    padding: 1rem;
    background: var(--hh-input-bg);
    border: 1px solid var(--hh-glass-border);
    border-radius: var(--hh-radius-md);
    color: var(--hh-text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.hh-form-group select {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    padding-right: 2.75rem;
    line-height: 1.35;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--hh-text-secondary) 50%),
        linear-gradient(135deg, var(--hh-text-secondary) 50%, transparent 50%);
    background-position:
        calc(100% - 1.15rem) calc(50% - 2px),
        calc(100% - 0.85rem) calc(50% - 2px);
    background-size: 7px 7px, 7px 7px;
    background-repeat: no-repeat;
}

.hh-form-group input:focus,
.hh-form-group select:focus,
.hh-form-group textarea:focus {
    outline: none;
    border-color: var(--hh-primary);
    box-shadow: 0 0 0 3px rgba(var(--hh-primary-rgb), 0.1);
    background: var(--hh-input-bg-focus);
}

.hh-form-group select option {
    background: var(--hh-dark-surface);
    color: var(--hh-text-primary);
}

/* Standalone input class (used outside .hh-form-group) */
.hh-input {
    width: 100%;
    padding: 1rem;
    background: var(--hh-input-bg);
    border: 1px solid var(--hh-glass-border);
    border-radius: var(--hh-radius-md);
    color: var(--hh-text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.hh-input:focus {
    outline: none;
    border-color: var(--hh-primary);
    box-shadow: 0 0 0 3px rgba(var(--hh-primary-rgb), 0.1);
    background: var(--hh-input-bg-focus);
}

/* --------------------------------------------------------------------------
   Shared Section/Card Patterns (Profile + Settings)
   -------------------------------------------------------------------------- */
.hh-ui-section-card-shell {
    border-radius: var(--hh-radius-card);
    border: 1px solid var(--hh-glass-border);
    background: var(--hh-dark-surface);
}

.hh-ui-section-head > h2,
.hh-ui-section-head > h3 {
    margin: 0 0 0.2rem;
    color: var(--hh-text-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.hh-ui-section-head > p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--hh-text-muted);
}

.hh-ui-row-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
}

/* --------------------------------------------------------------------------
   Collapsible Panel (Advanced / Optional sections)
   -------------------------------------------------------------------------- */
.hh-ui-collapsible {
    display: block;
    border-radius: 16px;
    border: 1px solid var(--hh-glass-border);
    background: var(--hh-surface-soft);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.hh-ui-collapsible[open] {
    border-color: rgba(var(--hh-primary-rgb), 0.22);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 0 0 1px rgba(var(--hh-primary-rgb), 0.08);
}

.hh-ui-collapsible > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    user-select: none;
}

.hh-ui-collapsible > summary::-webkit-details-marker {
    display: none;
}

.hh-ui-collapsible > summary:hover {
    background: var(--hh-surface-soft);
}

.hh-ui-collapsible-summary-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.hh-ui-collapsible-summary-title {
    color: var(--hh-text-primary);
    font-weight: 700;
    font-size: 0.95rem;
}

.hh-ui-collapsible-summary-copy {
    color: var(--hh-text-muted);
    font-size: 0.8125rem;
}

.hh-ui-collapsible-summary-meta {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--hh-glass-border);
    background: var(--hh-surface-soft);
    color: var(--hh-text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hh-ui-collapsible-summary-chevron {
    width: 0.65rem;
    height: 0.65rem;
    border-right: 2px solid var(--hh-text-secondary);
    border-bottom: 2px solid var(--hh-text-secondary);
    transform: rotate(45deg);
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.9;
    margin-right: 0.15rem;
    flex-shrink: 0;
}

.hh-ui-collapsible[open] .hh-ui-collapsible-summary-chevron {
    transform: rotate(225deg);
}

.hh-ui-collapsible-body {
    padding: 0 1rem 1rem;
}

/* --------------------------------------------------------------------------
   Shared Choice Chips / Tag Pickers (Profile, Onboarding, CompleteProfile)
   -------------------------------------------------------------------------- */
.hh-radio-group,
.hh-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.hh-radio-option,
.hh-checkbox-option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.75rem;
    font-size: 0.875rem;
    background: var(--hh-dark-elevated);
    border: 1px solid var(--hh-glass-border);
    border-radius: 12px;
    color: var(--hh-text-primary);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    font-weight: 500;
    text-align: center;
}

@media (hover: hover) {
    .hh-radio-option:hover,
    .hh-checkbox-option:hover {
        background: var(--hh-dark-surface);
        border-color: var(--hh-primary);
    }
}

.hh-radio-option input,
.hh-checkbox-option input {
    display: none;
}

.hh-radio-option.selected,
.hh-checkbox-option.selected {
    background: rgba(var(--hh-primary-rgb), 0.1);
    border-color: var(--hh-primary);
    color: var(--hh-text-primary);
}

.hh-interest-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: flex-start;
}

.hh-interest-tag-btn {
    background: var(--hh-dark-elevated);
    border: 1px solid var(--hh-glass-border);
    padding: 0.55rem 0.95rem;
    min-height: 44px;
    border-radius: var(--hh-radius-full);
    color: var(--hh-text-secondary);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.hh-interest-tag-btn:hover {
    background: var(--hh-dark-surface);
    border-color: var(--hh-primary);
    color: white;
}

.hh-interest-tag-btn.selected {
    background: rgba(var(--hh-primary-rgb), 0.1);
    color: var(--hh-text-primary);
    border-color: var(--hh-primary);
}

.hh-interest-custom {
    width: 100%;
    margin-top: 0.9rem;
}

.hh-interest-custom-label {
    display: block;
    font-size: 0.8rem;
    color: var(--hh-text-muted);
    margin-bottom: 0.35rem;
}

.hh-interest-custom-input-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.hh-interest-custom-input {
    flex: 1;
    min-width: 0;
}

.hh-interest-add-btn {
    min-width: 4.5rem;
}

.hh-custom-interest-list {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: flex-start;
}

.hh-custom-interest-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.hh-custom-interest-tag .mud-icon-root {
    font-size: 0.88rem !important;
}

/* EncryptionStatus */
.encryption-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.encryption-status.encrypted {
    background: rgba(var(--hh-security-rgb), 0.15);
    color: var(--hh-security);
    border: 1px solid rgba(var(--hh-security-rgb), 0.3);
}

.encryption-status.initializing {
    background: rgba(var(--hh-warning-rgb), 0.15);
    color: var(--hh-warning);
    border: 1px solid rgba(var(--hh-warning-rgb), 0.3);
}

.encryption-status.not-encrypted {
    background: rgba(var(--hh-danger-rgb), 0.15);
    color: var(--hh-danger);
    border: 1px solid rgba(var(--hh-danger-rgb), 0.3);
}

.lock-icon,
.unlock-icon {
    flex-shrink: 0;
}

.mini-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(var(--hh-warning-rgb), 0.3);
    border-top-color: var(--hh-warning);
    border-radius: 50%;
    animation: encryption-spin 1s linear infinite;
}

@keyframes encryption-spin {
    to { transform: rotate(360deg); }
}

.status-text {
    white-space: nowrap;
}
/* Native <dialog> wrapper: focus trapping, Escape, inert background, and focus restoration
   come from the platform; these styles provide the shared top-layer treatment. */
.hh-native-dialog {
    color: var(--hh-text-primary);
    max-height: calc(100dvh - 1rem - env(safe-area-inset-top, 0px));
    overflow-y: auto;
}

/* Keep dialog children as layout participants while stopping their clicks from
   bubbling to the native dialog's backdrop-dismiss handler. */
.hh-native-dialog-content {
    display: contents;
}

.hh-native-dialog::backdrop {
    background: rgba(15, 15, 19, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

html.hh-dialog-open,
html.hh-dialog-open body {
    overflow: hidden;
}
