/**
 * PMS Admin Modal Styles
 * 
 * Consolidated modal styles for admin interface
 * 
 * @package PMS
 * @since 1.0
 */

/* ===== MODAL OVERLAY ===== */
.pms-admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pms-admin-modal.active,
.pms-admin-modal.show {
    display: flex;
    opacity: 1;
    visibility: visible;
}

/* ===== MODAL CONTENT ===== */
.pms-admin-modal-content {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.pms-admin-modal.active .pms-admin-modal-content,
.pms-admin-modal.show .pms-admin-modal-content {
    transform: scale(1);
}

/* Default modal width for simple forms */
.pms-admin-modal-content {
    width: 500px;
    max-width: 90vw;
}

/* ===== MODAL HEADER ===== */
.pms-admin-modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pms-admin-modal-header h2,
.pms-admin-modal-header h3,
.pms-admin-modal-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
}

.pms-admin-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.pms-admin-modal-close:hover {
    background-color: #e9ecef;
    color: #495057;
}

/* ===== MODAL BODY ===== */
.pms-admin-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

/* ===== MODAL FOOTER ===== */
.pms-admin-modal-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ===== MODAL FORMS ===== */
.pms-admin-modal input[readonly],
.pms-admin-modal select:disabled {
    background-color: #f0f0f1;
    color: #50575e;
    cursor: not-allowed;
}

.pms-admin-modal .pms-admin-form-group {
    margin-bottom: 1rem;
}

.pms-admin-modal .pms-admin-form-group:last-child {
    margin-bottom: 0;
}

.pms-admin-modal .pms-admin-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.pms-admin-modal .pms-admin-select,
.pms-admin-modal .pms-admin-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.pms-admin-modal .pms-admin-select:focus,
.pms-admin-modal .pms-admin-textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 0.2rem rgba(0, 124, 186, 0.25);
}

.pms-admin-modal .pms-admin-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ===== SPECIFIC MODAL STYLES ===== */
/* Category and Component modals - optimized for simple forms */
#category-modal .pms-admin-modal-content,
#component-modal .pms-admin-modal-content {
    width: 500px;
    max-width: 90vw;
}

/* ===== MODAL BUTTONS ===== */
.pms-admin-modal .pms-admin-button {
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.pms-admin-modal .pms-admin-button-primary {
    background-color: #007cba;
    color: #ffffff;
    border-color: #007cba;
}

.pms-admin-modal .pms-admin-button-primary:hover {
    background-color: #005a87;
    border-color: #005a87;
}

.pms-admin-modal .pms-admin-button-secondary {
    background-color: #6c757d;
    color: #ffffff;
    border-color: #6c757d;
}

.pms-admin-modal .pms-admin-button-secondary:hover {
    background-color: #5a6268;
    border-color: #5a6268;
}

/* ===== MODAL LOADING STATE ===== */
.pms-admin-modal.loading .pms-admin-modal-content {
    position: relative;
}

.pms-admin-modal.loading .pms-admin-modal-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.pms-admin-modal.loading .pms-admin-modal-content::before {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    font-weight: 500;
    color: #495057;
}

/* ===== RESPONSIVE MODALS ===== */
@media (max-width: 768px) {
    .pms-admin-modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
        max-height: calc(100vh - 2rem);
    }
    
    .pms-admin-modal-header,
    .pms-admin-modal-body,
    .pms-admin-modal-footer {
        padding: 1rem;
    }
    
    .pms-admin-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pms-admin-modal-footer .pms-admin-button {
        width: 100%;
        justify-content: center;
    }
}

/* ===== WORDPRESS ADMIN COMPATIBILITY ===== */
body.admin-bar .pms-admin-modal {
    top: 32px;
    height: calc(100% - 32px);
}

@media (max-width: 782px) {
    body.admin-bar .pms-admin-modal {
        top: 46px;
        height: calc(100% - 46px);
    }
}
