/* Modal Container - Centered & Fixed */
.pg-edit-modal {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    z-index: 999999;
    
    /* Flexbox Centering Logic */
    display: flex; 
    justify-content: center; 
    align-items: center;
    
    /* Hidden by default using Opacity/Visibility to keep Flex display */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    
    padding: 15px; /* Padding for mobile edges */
    box-sizing: border-box;
}

/* Active State (Triggered by JS) */
.pg-edit-modal.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.pg-edit-overlay {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0,0,0,0.7); 
    backdrop-filter: blur(5px);
    z-index: 1;
}

/* Modal Box */
.pg-edit-modal-content {
    background: #fff; 
    width: 100%; 
    max-width: 500px;
    border-radius: 16px; 
    padding: 30px; 
    position: relative; 
    z-index: 2;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    
    /* Scroll Logic */
    max-height: 90vh; 
    overflow-y: auto;
    
    /* Smooth Scroll */
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

/* Header */
.pg-edit-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 25px; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 15px; 
    position: sticky;
    top: -30px; /* Stick to top inside padding */
    background: #fff;
    z-index: 10;
    margin-top: -10px;
}
.pg-edit-header h3 { margin: 0; font-size: 20px; font-weight: 800; color: #212529; }
#pg-edit-close { background: none; border: none; font-size: 28px; cursor: pointer; color: #999; line-height: 1; }
#pg-edit-close:hover { color: #ff3366; }

/* Form Fields */
.pg-edit-field-group { margin-bottom: 20px; }
.pg-edit-field-group label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; color: #343a40; }
.pg-edit-input {
    width: 100%; 
    padding: 12px; 
    border: 1px solid #ced4da; 
    border-radius: 8px; 
    font-size: 15px;
    box-sizing: border-box;
    font-family: inherit;
}
.pg-edit-input:focus { border-color: #ff3366; outline: none; }

/* Contributor Info */
.pg-contributor-info { margin-top: 30px; padding-top: 20px; border-top: 1px dashed #ccc; }
.pg-contributor-info input { width: 100%; padding: 12px; border: 1px solid #ced4da; border-radius: 8px; box-sizing: border-box; }

/* Submit Button */
.pg-submit-edit {
    width: 100%; background: #ff3366; color: #fff; border: none;
    padding: 14px; border-radius: 8px; font-weight: 700; margin-top: 20px; cursor: pointer; font-size: 16px;
    transition: background 0.2s;
}
.pg-submit-edit:hover { background: #e0244b; }
.pg-submit-edit:disabled { background: #ccc; cursor: not-allowed; }

.section-header .section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.pg-edit-btn {
    background: transparent;
    border: 1px solid #e1e1e1;
    padding: 6px 14px;
    border-radius: 20px; /* Pill shape */
    font-size: 13px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.pg-edit-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
    color: #000;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .pg-edit-modal-content {
        padding: 20px;
        max-height: 85vh;
    }
    .pg-edit-header h3 { font-size: 18px; }
}


@media (max-width: 768px) {
    .content-section {
        position: relative;
        padding-bottom: 70px !important;
    }

    .pg-edit-btn {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        
        background-color: #fff; /* White BG */
        border: 2px solid #ff3366; /* Pink Border */
        color: #ff3366 !important; /* Pink Text */
        
        border-radius: 8px;
        padding: 8px 30px;
        font-weight: bold;
        width: 80%; /* Screen ka 80% hissa */
        justify-content: center;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }

    .pg-edit-btn i { color: #ff3366; }
}