
/* ==========================================
   UNIFIED MODAL SYSTEM (Phase 1.1)
   ========================================== */

/* Modal Overlay/Backdrop */
.hs-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    overflow-y: auto;
}

/* Modal Shell */
.hs-modal {
    background: var(--surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 600px; /* Default width, can be overridden */
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    outline: none;
}

/* Modal Header */
.hs-modal-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    background: var(--surface-3); /* Slightly elevated header */
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.hs-modal-title {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.hs-modal-close {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: var(--font-size-xl);
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: color 0.2s ease, background 0.2s ease;
    line-height: 1;
}

.hs-modal-close:hover {
    color: var(--text-primary);
    background: var(--surface-4);
}

/* Modal Body */
.hs-modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    flex: 1;
    /* Ensure text is readable */
    color: var(--text-secondary);
}

.hs-modal-body p {
    margin-bottom: var(--space-4);
    line-height: 1.6;
}

/* Modal Footer */
.hs-modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-subtle);
    background: var(--surface-3);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* Modal Actions */
.hs-modal-btn-primary {
    background: var(--primary-600);
    color: white;
    border: 1px solid var(--primary-700);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hs-modal-btn-primary:hover {
    background: var(--primary-500);
}

.hs-modal-btn-secondary {
    background: var(--surface-4);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hs-modal-btn-secondary:hover {
    background: var(--surface-3);
    border-color: var(--text-tertiary);
}

/* Compatibility aliases for existing classes (Migration path) */
.hs-modal-content {
    background: var(--surface-2) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: var(--shadow-xl) !important;
}

.hs-modal-content header,
.hs-modal-content .modal-header {
    border-bottom: 1px solid var(--border-subtle) !important;
}

.hs-modal-content footer,
.hs-modal-content .modal-footer {
    border-top: 1px solid var(--border-subtle) !important;
}

.hs-modal-content h1, .hs-modal-content h2, .hs-modal-content h3 {
    color: var(--text-primary) !important;
    text-shadow: none !important;
}

