/* Certificate Modal Styles */
.imc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    display: none;
}

.imc-modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    display: none;
}

.imc-certificate-modal {
    padding: 0;
}

.imc-modal-content {
    position: relative;
    padding: 30px;
}

.imc-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.imc-modal-close:hover {
    color: #333;
}

.imc-modal-content h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.5em;
}

.imc-modal-content form {
    margin: 0;
}

.imc-modal-content p {
    margin: 0 0 15px 0;
}

.imc-modal-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.imc-modal-content input[type="text"],
.imc-modal-content input[type="email"],
.imc-modal-content select,
.imc-modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.imc-modal-content input[type="text"]:focus,
.imc-modal-content input[type="email"]:focus,
.imc-modal-content select:focus,
.imc-modal-content textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.imc-modal-content textarea {
    resize: vertical;
    min-height: 80px;
}

/* Checkbox styling */
.imc-modal-content input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    vertical-align: top;
    margin-top: 2px;
}

.imc-modal-content label[for="cert_info_confirmed"],
.imc-modal-content label:has(input[type="checkbox"]) {
    display: flex;
    align-items: flex-start;
    font-weight: normal;
    line-height: 1.4;
    margin-bottom: 15px;
}

.imc-modal-content label:has(input[type="checkbox"]) input[type="checkbox"] {
    flex-shrink: 0;
}

.imc-form-actions {
    margin-top: 25px;
    text-align: right;
}

.imc-form-actions .button {
    margin-left: 10px;
}

.imc-form-actions .imc-modal-cancel {
    background: #f7f7f7;
    color: #333;
    border: 1px solid #ddd;
}

.imc-form-actions .imc-modal-cancel:hover {
    background: #e7e7e7;
}

.imc-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

/* Body scroll lock when modal is open */
body.imc-modal-open {
    overflow: hidden;
}

/* Add certificate button styles */
.add-certificate-btn {
    margin-top: 15px !important;
    background: #0073aa !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
}

.add-certificate-btn:hover {
    background: #005a87 !important;
}

/* Certificate products section */
.certificate-products-section {
    margin-top: 20px;
}

.certificate-products-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.2em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.certificate-product-item {
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
    transition: border-color 0.2s ease;
}

.certificate-product-item:hover {
    border-color: #0073aa;
}

.certificate-product-item h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.1em;
}

.certificate-product-item p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 0.9em;
}

/* Completed product styling */
.certificate-product-item.completed {
    background: #f0f8f0;
    border-color: #2d5a2d;
}

.certificate-product-item.completed h4 {
    color: #2d5a2d;
}

.certificate-product-item.completed p {
    color: #2d5a2d;
}

/* Product certificates display */
.product-certificates {
    margin-bottom: 20px;
}

.product-certificates h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.1em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

/* Summary message styling */
.woocommerce-subscription-certificates > p:first-of-type {
    background: #e7f3ff;
    border: 1px solid #0073aa;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    color: #333;
}

.woocommerce-subscription-certificates > p:first-of-type strong {
    color: #0073aa;
}

/* Responsive design */
@media (max-width: 768px) {
    .imc-modal-container {
        width: 95%;
        margin: 20px;
    }
    
    .imc-modal-content {
        padding: 20px;
    }
    
    .imc-form-actions {
        text-align: center;
    }
    
    .imc-form-actions .button {
        display: block;
        width: 100%;
        margin: 5px 0;
    }
    
    .certificate-product-item {
        padding: 12px;
    }
    
    .add-certificate-btn {
        width: 100%;
        text-align: center;
    }
}

/* Error and success message styling */
.imc-certificate-modal .woocommerce-error,
.imc-certificate-modal .woocommerce-message {
    margin: 0 0 20px 0;
    padding: 10px 15px;
    border-radius: 4px;
}

.imc-certificate-modal .woocommerce-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.imc-certificate-modal .woocommerce-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
} 