/*======================================================
  Manage Contacts Modal
======================================================*/

.manage-contacts-modal {
    position: fixed;
    inset: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    background: rgba(0, 0, 0, 0.55);

    z-index: 3000;
}

.manage-contacts-modal.hidden {
    display: none;
}

/*======================================================
  Dialog
======================================================*/

.manage-contacts-dialog {

    width: 92%;
    max-width: 1000px;

    max-height: 90vh;

    background: #ffffff;

    border-radius: 10px;

    box-shadow: 0 15px 40px rgba(0,0,0,.25);

    display: flex;
    flex-direction: column;

    overflow: hidden;

}

/*======================================================
  Header
======================================================*/

.manage-contacts-titlebar {

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 16px 22px;

    background: #1f2937;

    color: white;

}

.manage-contacts-titlebar h2 {

    margin: 0;

    font-size: 22px;

    font-weight: 600;

}

.manage-contacts-close {

    border: none;

    background: transparent;

    color: white;

    font-size: 30px;

    cursor: pointer;

    transition: .2s;

}

.manage-contacts-close:hover {

    color: #d1d5db;

}

/*======================================================
  Content
======================================================*/

.manage-contacts-content {

    padding: 20px;

    overflow-y: auto;

    flex: 1;

}

/*======================================================
  Member Information
======================================================*/

#manage-contacts-member-info {

    background: #f8fafc;

    border: 1px solid #dbe3ea;

    border-radius: 8px;

    padding: 15px 18px;

    margin-bottom: 20px;

    line-height: 1.6;

}

/*======================================================
  Contacts Table
======================================================*/

#manage-contacts-list table {

    width: 100%;

    border-collapse: collapse;

}

#manage-contacts-list th {

    background: #f3f4f6;

    padding: 12px;

    text-align: left;

    border-bottom: 2px solid #d1d5db;

    font-weight: 600;

}

#manage-contacts-list td {

    padding: 12px;

    border-bottom: 1px solid #e5e7eb;

}

#manage-contacts-list tr:hover {

    background: #f9fafb;

}

/*======================================================
  Buttons
======================================================*/

.manage-contact-btn {

    border: none;

    border-radius: 5px;

    padding: 6px 12px;

    cursor: pointer;

    font-size: 14px;

    transition: .2s;

}

.manage-contact-btn:hover {

    opacity: .9;

}

.manage-contact-btn.edit {

    background: #2563eb;

    color: white;

}

.manage-contact-btn.delete {

    background: #dc2626;

    color: white;

}

.manage-contact-btn.add {

    background: #059669;

    color: white;

}

/*======================================================
  Footer
======================================================*/

.manage-contacts-footer {

    display: flex;

    justify-content: flex-end;

    gap: 10px;

    padding: 16px 20px;

    border-top: 1px solid #e5e7eb;

    background: #f9fafb;

}

/*======================================================
 Contact Editor Modal
======================================================*/

.contact-editor-modal {

    position: fixed;

    inset: 0;

    display: flex;

    justify-content: center;

    align-items: center;

    background: rgba(0,0,0,.55);

    z-index: 3100;

}

.contact-editor-modal.hidden {

    display: none;

}

.contact-editor-dialog {

    width: 700px;

    max-width: 95%;

    background: white;

    border-radius: 10px;

    overflow: hidden;

    max-height: calc(100dvh - 32px);

    display: flex;

    flex-direction: column;

    box-shadow: 0 15px 35px rgba(0,0,0,.25);

}

.contact-editor-titlebar {

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 16px 20px;

    background: #1f2937;

    color: white;

    flex-shrink: 0;

}

.contact-editor-close {

    border: none;

    background: transparent;

    color: white;

    font-size: 28px;

    cursor: pointer;

}

.contact-editor-content {

    padding: 20px;

    overflow-y: auto;

    -webkit-overflow-scrolling: touch;

}

.contact-editor-footer {

    padding: 16px 20px;

    display: flex;

    justify-content: flex-end;

    gap: 10px;

    border-top: 1px solid #e5e7eb;

    flex-shrink: 0;

}

.form-grid {

    display: grid;

    grid-template-columns: repeat(2,1fr);

    gap: 16px;

}

.form-group {

    display: flex;

    flex-direction: column;

}

.form-group label {

    margin-bottom: 6px;

    font-weight: 600;

}

.form-group input,
.form-group select,
.form-group textarea {

    padding: 10px;

    border: 1px solid #d1d5db;

    border-radius: 6px;

    font-size: 14px;

}

.permission-grid {

    display: flex;

    gap: 30px;

    margin-top: 20px;

}

/*======================================================
  Contact Editor — Mobile
======================================================*/
@media (max-width: 768px) {

    .contact-editor-modal {

        align-items: stretch;

        padding: 12px;

    }

    .contact-editor-dialog {

        width: 100%;

        max-width: none;

        max-height: calc(100dvh - 24px);

        border-radius: 8px;

    }

    .contact-editor-titlebar {

        padding: 12px 14px;

    }

    .contact-editor-titlebar h2 {

        margin: 0;

        font-size: 1.15rem;

        overflow-wrap: anywhere;

    }

    .contact-editor-close {

        width: 44px;

        min-height: 44px;

        padding: 0;

        line-height: 1;

    }

    .contact-editor-content {

        padding: 16px 14px;

    }

    .contact-editor-content .form-grid {

        grid-template-columns: 1fr;

        gap: 14px;

    }

    .contact-editor-content .form-group input,
    .contact-editor-content .form-group select,
    .contact-editor-content .form-group textarea {

        width: 100%;

        min-height: 44px;

        font-size: 16px;

    }

    .contact-editor-content .form-group textarea {

        min-height: 96px;

    }

    .contact-editor-content .permission-grid {

        flex-direction: column;

        gap: 12px;

        margin-top: 16px;

    }

    .contact-editor-content .permission-grid label {

        display: flex;

        align-items: center;

        gap: 10px;

        min-height: 44px;

    }

    .contact-editor-footer {

        padding: 12px 14px;

        flex-direction: column-reverse;

        align-items: stretch;

    }

    .contact-editor-footer button {

        width: 100%;

        min-height: 44px;

    }

}
