/* ===========================
   Hospital Procedures Plugin
   Frontend Styles
=========================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Serif+Display&display=swap');

.hp-procedures-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    box-sizing: border-box;
}

/* ── Wyrwanie z ograniczeń kontenera Elementora ──
   Technika "full-bleed": przesuwa element poza rodzica
   i wyśrodkowuje go względem okna przeglądarki.
   Działa z większością motywów i Elementorem.
── */
.hp-procedures-wrapper {
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
    max-width: 100vw;
    padding-left: max(24px, calc((100vw - 1200px) / 2));
    padding-right: max(24px, calc((100vw - 1200px) / 2));
    box-sizing: border-box;
}

/* ── Individual Procedure ── */
.hp-procedure {
    background: #ffffff;
    border: 1px solid #e8ecef;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s ease;
}

.hp-procedure:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ── Header ── */
.hp-procedure-header {
    background: linear-gradient(135deg, #1a3a5c 0%, #1e4976 100%);
    padding: 20px 28px;
    position: relative;
    overflow: hidden;
}

.hp-procedure-header::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
}

.hp-procedure-header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    right: 40px;
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}

.hp-procedure-title {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.25rem !important;
    font-weight: 400 !important;
    color: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    letter-spacing: 0.3px;
    position: relative;
    z-index: 1;
    border: none !important;
}

/* ── Description wrap (contains desc + toggle button) ── */
.hp-procedure-description-wrap {
    border-bottom: 1px solid #f0f3f6;
}

/* ── Description ── */
.hp-procedure-description {
    padding: 22px 28px 0;
}

/* Collapsed state — clamp to preview height */
.hp-procedure-description.hp-collapsible.hp-is-collapsed {
    max-height: var(--hp-preview-height, 80px);
    overflow: hidden;
    -webkit-mask-image: linear-gradient(
        to bottom,
        black 55%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        black 55%,
        transparent 100%
    );
}

/* Expanded state — animate open */
.hp-procedure-description.hp-collapsible:not(.hp-is-collapsed) {
    max-height: 9999px;
    -webkit-mask-image: none;
    mask-image: none;
    padding-bottom: 0;
}

/* Smooth transition */
.hp-procedure-description.hp-collapsible {
    transition: max-height 0.35s ease;
}

.hp-procedure-description p {
    margin: 0 0 12px;
    color: #374151;
    font-size: 0.925rem;
    line-height: 1.7;
    font-weight: 300;
}

.hp-procedure-description p:last-child {
    margin-bottom: 0;
}

/* ── Toggle button ── */
.hp-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px 28px 12px;
    background: none;
    border: none;
    border-top: 1px dashed #e2e8f0;
    cursor: pointer;
    color: #3a7bbf;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-align: left;
    transition: color 0.15s ease, background 0.15s ease;
    margin-top: 2px;
}

.hp-toggle-btn:hover {
    color: #1a3a5c;
    background: #f7fafd;
}

.hp-toggle-btn:focus {
    outline: 2px solid #3a7bbf;
    outline-offset: -2px;
}

.hp-toggle-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

/* Rotate arrow when expanded */
.hp-toggle-btn.hp-toggle-open .hp-toggle-icon {
    transform: rotate(180deg);
}

/* ── Attachments ── */
.hp-attachments {
    padding: 20px 28px;
    background: #fafbfc;
}

.hp-attachments-title {
    font-family: 'DM Sans', sans-serif !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    color: #9ca3af !important;
    text-transform: uppercase !important;
    letter-spacing: 1.2px !important;
    margin: 0 0 14px !important;
    padding: 0 !important;
    border: none !important;
}

.hp-attachments-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hp-attachment-item {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.hp-attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none !important;
    color: #1a3a5c !important;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.18s ease;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.hp-attachment-link:hover {
    background: #1a3a5c;
    border-color: #1a3a5c;
    color: #ffffff !important;
    text-decoration: none !important;
    transform: translateX(3px);
    box-shadow: 0 2px 12px rgba(26, 58, 92, 0.18);
}

.hp-att-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: #4e8cc5;
    transition: color 0.18s ease;
}

.hp-attachment-link:hover .hp-att-icon {
    color: rgba(255,255,255,0.85);
}

.hp-att-label {
    flex: 1;
    line-height: 1.3;
}

.hp-att-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #ebf4ff;
    color: #2563eb;
    flex-shrink: 0;
    transition: all 0.18s ease;
}

.hp-attachment-link:hover .hp-att-badge {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}

/* ── No procedures message ── */
.hp-no-procedures {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 40px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .hp-procedure-header {
        padding: 16px 20px;
    }
    .hp-procedure-description {
        padding: 16px 20px 0;
    }
    .hp-toggle-btn {
        padding: 10px 20px 12px;
    }
    .hp-attachments {
        padding: 16px 20px;
    }
    .hp-procedure-title {
        font-size: 1.1rem !important;
    }
}
