/* Advanced Popup Manager - Frontend Popup Styles */

.apm-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.apm-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.apm-popup-content {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    transform: translateY(-50px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.apm-popup-overlay.active .apm-popup-content {
    transform: translateY(0);
}

.apm-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    color: #666;
    line-height: 1;
}

.apm-popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

.apm-popup-body h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
    color: #333;
    font-weight: 600;
}

.apm-popup-form {
    margin: 0;
}

.apm-popup-form .apm-form-field {
    margin-bottom: 20px;
}

.apm-popup-form .apm-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.apm-popup-form input,
.apm-popup-form textarea,
.apm-popup-form select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 15px;
    transition: border 0.2s;
    font-family: inherit;
}

.apm-popup-form input:focus,
.apm-popup-form textarea:focus,
.apm-popup-form select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.apm-popup-form textarea {
    min-height: 100px;
    resize: vertical;
}

.apm-popup-form .apm-form-actions {
    margin-top: 25px;
}

.apm-popup-form .apm-submit-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
    font-weight: 600;
    transition: background 0.2s;
    font-family: inherit;
}

.apm-popup-form .apm-submit-btn:hover {
    background: #005a87;
}

.apm-popup-form .apm-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.apm-popup-trigger {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s;
    font-family: inherit;
}

.apm-popup-trigger:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

.apm-required {
    color: #e00;
    font-weight: normal;
}

.apm-form-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.apm-form-error ul {
    margin: 0;
    padding-left: 20px;
}

.apm-form-success {
    background: #d4edda;
    color: #155724;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

/* Loading state */
.apm-popup-form.loading .apm-submit-btn {
    position: relative;
    pointer-events: none;
}

.apm-popup-form.loading .apm-submit-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: apm-spin 1s linear infinite;
}

@keyframes apm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive styles */
@media (max-width: 768px) {
    .apm-popup-content {
        margin: 20px;
        width: calc(100% - 40px);
        max-width: none;
        padding: 20px;
    }
    
    .apm-popup-body h3 {
        font-size: 20px;
    }
    
    .apm-popup-trigger {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .apm-popup-content {
        margin: 10px;
        width: calc(100% - 20px);
        padding: 15px;
    }
    
    .apm-popup-close {
        top: 10px;
        right: 10px;
    }
}