/**
 * Certificate Replacement modal + product-page form styles.
 *
 * Originally inline in pat-certificate-replacement.php enqueue function.
 */

.pat-replacement-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.pat-replacement-modal.active {
    display: block;
}

.pat-replacement-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.pat-replacement-modal-content {
    position: relative;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 10001;
    overflow: visible;
}

.pat-replacement-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pat-replacement-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

.pat-replacement-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.pat-replacement-modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.pat-replacement-modal-close svg {
    width: 20px;
    height: 20px;
}

.pat-replacement-modal-body {
    padding: 24px;
    overflow: visible;
    flex: 1;
    min-height: 0;
}

.pat-replacement-form-group {
    margin-bottom: 20px;
}

.pat-replacement-form-group label {
    display: block;
    font-weight: 600;
    color: #475569;
    font-size: 14px;
    margin-bottom: 8px;
}

.pat-replacement-form-group label .required {
    color: #ef4444;
}

.pat-replacement-form-group input,
.pat-replacement-form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 5px;
    font-size: 15px;
    transition: all 0.2s;
}

.pat-replacement-form-group input:focus,
.pat-replacement-form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pat-replacement-form-group .error-message {
    color: #ef4444;
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

.pat-replacement-form-group.error input,
.pat-replacement-form-group.error select {
    border-color: #ef4444;
}

.pat-replacement-form-group.error .error-message {
    display: block;
}

.pat-replacement-choice-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.pat-replacement-choice-btn {
    flex: 1;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-weight: 600;
    color: #475569;
}

.pat-replacement-choice-btn:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.pat-replacement-choice-btn.active {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
}

.pat-replacement-member-search {
    position: relative;
}

.pat-replacement-member-search input {
    padding-right: 40px;
}

.pat-replacement-member-search-results {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: white !important;
    border: 2px solid #e2e8f0 !important;
    border-top: none !important;
    border-radius: 0 0 5px 5px !important;
    height: 300px !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 10000 !important;
    display: none !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    margin-top: 2px !important;
}

.pat-replacement-member-search-results.active {
    display: block !important;
}

.pat-replacement-member-result {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.2s;
}

.pat-replacement-member-result:hover {
    background: #f8fafc;
}

.pat-replacement-member-result:last-child {
    border-bottom: none;
}

.pat-replacement-member-result-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.pat-replacement-member-result-details {
    font-size: 13px;
    color: #64748b;
}

.pat-replacement-loading {
    text-align: center;
    padding: 20px;
    color: #64748b;
}

.pat-replacement-search-loading {
    text-align: center;
    padding: 20px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pat-replacement-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: pat-replacement-spin 0.8s linear infinite;
}

@keyframes pat-replacement-spin {
    to { transform: rotate(360deg); }
}

.pat-replacement-success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 10002;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: pat-replacement-slide-in 0.3s ease-out;
    max-width: 400px;
}

@keyframes pat-replacement-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pat-replacement-success-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.pat-replacement-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.pat-replacement-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.pat-replacement-btn-primary {
    background: #3b82f6;
    color: white;
}

.pat-replacement-btn-primary:hover {
    background: #2563eb;
}

.pat-replacement-btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.pat-replacement-btn-secondary:hover {
    background: #cbd5e1;
}

.pat-replacement-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pat-replacement-product-form {
    margin: 24px 0;
    padding: 24px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.pat-replacement-product-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: #1e293b;
}
