/* ==========================================================================
   PCBSage Global Pop-Up Architecture & Stylesheet (popups.css)
   Typography: Source Code Pro & Source Sans Pro
   Shapes: Engineered Signature Notched Geometry
   ========================================================================== */

/* 1. Universal Modal Overlay & Backdrop */
.hud-popup-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-popup-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 2. Outer Shadow Wrapper (Ensures drop-shadow contours around clipped notches) */
.hud-popup-shadow-wrapper {
    filter: drop-shadow(0 20px 35px rgba(0, 0, 0, 0.22)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.12));
    width: 100%;
    display: flex;
    justify-content: center;
    transform: scale(0.94) translateY(8px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-popup-overlay.is-active .hud-popup-shadow-wrapper {
    transform: scale(1) translateY(0);
}

/* 3. Base Pop-Up Card with Signature Notched Shape */
.hud-popup-card {
    background-color: #ffffff;
    position: relative;
    width: 100%;
    /* Signature Chamfered Notched Corners */
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
    -webkit-clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
    border-top: 4px solid var(--popup-theme-color, #b06a41);
    box-sizing: border-box;
}

/* Theme Color Tokens */
.hud-popup-card.theme-success {
    --popup-theme-color: #00875A;
    --popup-theme-bg: rgba(0, 135, 90, 0.08);
}

.hud-popup-card.theme-danger {
    --popup-theme-color: #DC2626;
    --popup-theme-bg: rgba(220, 38, 38, 0.08);
}

.hud-popup-card.theme-warning {
    --popup-theme-color: #D97706;
    --popup-theme-bg: rgba(217, 119, 6, 0.08);
}

.hud-popup-card.theme-brand,
.hud-popup-card.theme-interactive {
    --popup-theme-color: #b06a41;
    --popup-theme-bg: rgba(176, 106, 65, 0.08);
}

/* ==========================================================================
   CATEGORY 1: QUICK POP-UP SPECIFICATIONS
   ========================================================================== */
.hud-popup-card--quick {
    max-width: 400px;
    padding: 32px 28px 24px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* 3.1 Circular Icon Container */
.hud-popup-quick-icon-box {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 2.5px solid var(--popup-theme-color, #00875A);
    background-color: var(--popup-theme-bg, rgba(0, 135, 90, 0.08));
    color: var(--popup-theme-color, #00875A);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.hud-popup-quick-icon-box .material-symbols-outlined {
    font-size: 1.85rem;
    font-weight: 700;
}

/* 3.2 Title (Source Code Pro) */
.hud-popup-quick-title {
    font-family: 'Source Code Pro', monospace;
    font-weight: 700;
    font-size: 1.3rem;
    color: #111827;
    margin: 0 0 8px 0;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

/* 3.3 Message / Description */
.hud-popup-quick-desc {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
    color: #4B5563;
    line-height: 1.45;
    margin: 0 0 24px 0;
    max-width: 320px;
}

/* Action Buttons Container */
.hud-popup-quick-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

/* 3.4 Primary CTA Button (Solid Theme Color) */
.hud-popup-btn-primary {
    font-family: 'Source Code Pro', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: var(--popup-theme-color, #00875A);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 10px 18px;
    height: 42px;
    cursor: pointer;
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: filter 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
    text-decoration: none;
    box-sizing: border-box;
}

.hud-popup-btn-primary:hover {
    filter: brightness(0.92);
    transform: translateY(-1px);
}

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

/* 3.5 Secondary CTA Button (Outline) */
.hud-popup-btn-secondary {
    font-family: 'Source Code Pro', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #ffffff;
    color: #374151;
    border: 1.5px solid #D1D5DB;
    border-radius: 4px;
    padding: 10px 18px;
    height: 42px;
    cursor: pointer;
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
    text-decoration: none;
    box-sizing: border-box;
}

.hud-popup-btn-secondary:hover {
    border-color: #9CA3AF;
    background-color: #F9FAFB;
    color: #111827;
    transform: translateY(-1px);
}

.hud-popup-btn-secondary:active {
    transform: translateY(0);
}

/* ==========================================================================
   CATEGORY 2: DETAILED POP-UP SPECIFICATIONS
   ========================================================================== */
.hud-popup-card--detailed {
    max-width: 600px;
    display: flex;
    flex-direction: column;
    text-align: left;
    max-height: 85vh;
}

/* Structured Header */
.hud-popup-detailed-header {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #E5E7EB;
    background-color: #FAFAFA;
}

.hud-popup-detailed-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-popup-detailed-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-color: var(--popup-theme-bg, rgba(176, 106, 65, 0.08));
    color: var(--popup-theme-color, #b06a41);
}

.hud-popup-detailed-title {
    font-family: 'Source Code Pro', monospace;
    font-weight: 700;
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #111827;
    margin: 0;
}

.hud-popup-detailed-badge {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    background-color: #F3F4F6;
    color: #4B5563;
    letter-spacing: 0.04em;
}

.hud-popup-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #9CA3AF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    transition: all 0.15s ease;
    padding: 0;
}

.hud-popup-close-btn:hover {
    color: #DC2626;
    background-color: rgba(220, 38, 38, 0.08);
}

/* Scrollable Form Body */
.hud-popup-detailed-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
}

/* Form Rails inside Detailed Pop-up */
.hud-popup-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hud-popup-field-label {
    font-family: 'Source Code Pro', monospace;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
}

.hud-popup-preview-card {
    border: 1px solid #E5E7EB;
    border-left: 4px solid var(--popup-theme-color, #b06a41);
    background-color: #F9FAFB;
    border-radius: 6px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

/* Pinned Action Footer */
.hud-popup-detailed-footer {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #E5E7EB;
    background-color: #FAFAFA;
    gap: 12px;
}

.hud-popup-detailed-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-popup-detailed-footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Responsive Adaptations */
@media (max-width: 640px) {
    .hud-popup-card--detailed {
        max-height: 90vh;
    }

    .hud-popup-detailed-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .hud-popup-detailed-footer-left,
    .hud-popup-detailed-footer-right {
        width: 100%;
        justify-content: stretch;
    }

    .hud-popup-detailed-footer-left button,
    .hud-popup-detailed-footer-right button {
        flex: 1;
    }
}

/* ==========================================================================
   CATEGORY 3: POP-UP SPECIFICATIONS (Data-Dense Inspector)
   ========================================================================== */
.hud-popup-overlay.is-fullscreen {
    padding: 2rem 1.5rem;
    align-items: center;
    justify-content: center;
}

.hud-popup-overlay.is-fullscreen .hud-popup-shadow-wrapper {
    width: 100%;
    max-width: 680px;
    height: 95vh;
    transform: none;
    filter: drop-shadow(0 20px 35px rgba(0, 0, 0, 0.25));
    display: flex;
}

.hud-popup-card--fullscreen {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    clip-path: none;
    -webkit-clip-path: none;
    display: flex;
    flex-direction: column;
    text-align: left;
    background-color: #ffffff;
    box-sizing: border-box;
    overflow: hidden;
}

.hud-fullscreen-header {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    background-color: #ffffff;
    flex-shrink: 0;
    gap: 16px;
}

.hud-fullscreen-subtitle {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 2px;
}

.hud-fullscreen-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    background-color: #f8fafc;
    box-sizing: border-box;
}

.hud-fullscreen-footer {
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #e2e8f0;
    background-color: #ffffff;
    flex-shrink: 0;
    gap: 12px;
}

/* Data-Dense HTML Table Layout */
.hud-dense-table-container {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.hud-dense-param-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.hud-dense-param-table th {
    background-color: #f8fafc;
    color: #475569;
    font-family: 'Source Code Pro', monospace;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 9px 16px;
    border-bottom: 2px solid #cbd5e1;
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: left;
}

.hud-dense-param-table td {
    padding: 6px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.hud-param-group-header td {
    background-color: #f1f5f9;
    border-top: 2px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    padding: 8px 16px;
}

.hud-group-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-group-title {
    font-family: 'Source Code Pro', monospace;
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0f172a;
}

.hud-dense-param-table tr:hover:not(.hud-param-group-header) {
    background-color: rgba(176, 106, 65, 0.04);
}

.hud-param-name {
    font-family: 'Source Sans Pro', -apple-system, sans-serif;
    font-weight: 600;
    color: #1e293b;
}

.hud-param-key {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.75rem;
    color: #64748b;
    background-color: #f8fafc;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #e2e8f0;
    display: inline-block;
}

.hud-param-val {
    font-family: 'Source Code Pro', monospace;
    color: #0f172a;
    font-weight: 500;
}

.hud-row-hidden {
    display: none !important;
}

.hud-group-hidden {
    display: none !important;
}

.hud-filter-pill {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 3px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
}

.hud-filter-pill:hover,
.hud-filter-pill.active {
    background: var(--popup-theme-color, #b06a41);
    color: #ffffff;
    border-color: var(--popup-theme-color, #b06a41);
}
